Pythonification of the asterisk-based collection packing/unpacking syntax

Chris Angelico rosuav at gmail.com
Mon Dec 26 19:52:41 EST 2011


On Tue, Dec 27, 2011 at 10:44 AM, Eelco <hoogendoorn.eelco at gmail.com> wrote:
> extended collection unpacking, as in 'head,*tail=sequence', is quite a
> rare construct indeed, and here I very strongly feel a more explicit
> syntax is preferrable.

You may be right, but...

> ... if collection packing/unpacking would be
> presented as a more general construct from the start,
> 'head,tail::tuple=sequence' would be hard to miss.

... it doesn't really justify a _change_. When a language is in its
infancy and the only code written in it is on the designers' own
computers, these sorts of debates can be tipped by relatively small
differences - is it more readable, is it quick enough to type, etc.
But once a language reaches a level of maturity, changes need to
overwhelm the "but it's a change" hurdle - breaking existing code is
majorly dangerous, and keeping two distinct ways of doing something
means you get the worst of both worlds.

We can argue till the cows come home as to which way would be better,
_had Python started with it_. I don't think there's anything like
enough difference to justify the breakage/duplication.

ChrisA



More information about the Python-list mailing list