> 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?


Peter's suggestion is more Pythonic.  The list argument is explicit.
It requires less esoteric knowledge of both vararity functions and the
unpacking operator.  It reads much more easily.

It wins.  :P
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to