How to pass list elements as arguments

Use the * argument unpacking operator:

seq = [1, 2, 3]
foo(*seq)

So in the input function you could use

getattr(self, func)(*args)

PS. Don’t name your variables list, since it shadows the built-in of the same name.

Leave a Comment