[Tutor] Convert a list to a group of separated strings

Juan Christian juan0christian at gmail.com
Thu Sep 11 19:49:24 CEST 2014


Done. thanks guys.

On Thu, Sep 11, 2014 at 2:43 PM, Danny Yoo <dyoo at hashcollision.org> wrote:

> > On Thu, Sep 11, 2014 at 2:09 PM, Peter Otten <__peter__ at 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140911/215ec267/attachment-0001.html>


More information about the Tutor mailing list