Pythonification of the asterisk-based collection packing/unpacking syntax

Eelco hoogendoorn.eelco at gmail.com
Mon Dec 19 05:15:11 EST 2011


On Dec 19, 3:23 am, alex23 <wuwe... at gmail.com> wrote:
> Evan Driscoll <edrisc... at wisc.edu> wrote:
> > My problem with it is that it in some sense is forcing me to make a
> > decision I don't care about. Yes, what we have now is less flexible, but
> > I have *never* said "man, I wish this *args parameter were a list
> > instead of a tuple".
>
> And if you _did_, then one of the first lines in your function would
> be:
>
>     args = list(args)
>
> Which is obvious to everyone, doesn't modify existing behaviour,
> doesn't force everyone without a fetish for change to add unnecessary
> cruft to their function signature...

Its obvious you end up with a list (assuming args is an iterable);
knowing what args was to begin with suffers from the same problems.

> Except, OMG, list() is RETURNING A LIST, which is an OBVIOUS type
> constraint. I propose that:
>
>     args = @set list(args)
>
> Will coerce args into a list and then give me a set in return.

?
What does that have to do with collection packing/unpacking?



More information about the Python-list mailing list