On Thu, Sep 11, 2014 at 2:07 PM, Danny Yoo <d...@hashcollision.org> wrote: > > > Hi Juan, > > You have a "var-arity" function called fetch_users(), and you'd like > to apply it with an explicit list of arguments "my_list". > > In this case, you want to use the application operator: > > > https://docs.python.org/2/tutorial/controlflow.html#tut-unpacking-arguments > > ######################## > fetch_users(*my_list) > ######################## > > If you have other questions, please feel free to ask. >
Indeed, this way works flawlessly, thanks. On Thu, Sep 11, 2014 at 2:09 PM, Peter Otten <__pete...@web.de> wrote: > > > You can explode the list by invoking the function with > > fetch_users(*my_list) # prepend the list with a star > > but I recommend that you change the function's signature to > > def fetch_users(steamids): > ... > > and invoke it in the common way with > > fetch_users(my_list) > > That of course means that even to invoke the function with a single user > you > have to wrap the user's id in a list: > > fetch_users(["76561198048214059"]) > I was thinking about that too, I'll try to implement that way. Which one would be a more pythonic way?
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor