Sunday, 29 September 2013

Generating variable amounts of parameters for function call in code

Generating variable amounts of parameters for function call in code

I have a function I need to call with a certain amount of parameters based
on certain variables, something like this:
self.model = Gtk.ListStore(str for i in len(dictionary))
Of course that doesn't work since str for i in len(dictionary) results in
a list: [str, str, str, str]
While I can always just write 4 lines and a bunch of if statements for
each alternative there must be a better way of doing this.

No comments:

Post a Comment