Pythonification of the asterisk-based collection packing/unpacking syntax

alex23 wuwei23 at gmail.com
Sun Dec 18 21:23:41 EST 2011


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

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.



More information about the Python-list mailing list