[Python-ideas] Javascript Destructuring Assignment

Larry Hastings larry at hastings.org
Sun Mar 11 09:56:44 CET 2007


Brett Cannon wrote:
> On 3/5/07, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
>   
>> One thing I *would* like to see, that Javascript doesn't
>> seem to have either yet, is a *-arg on the end of the
>> unpacking list:
>>    a, b, *c = [1, 2, 3, 4, 5]
>> giving a == 1, b == 2, c == [3, 4, 5].
> Now I know that was discussed on python-dev once, but I don't remember why didn't end up happening.
Surely you haven't forgotten your own recipe?
    http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/163968
That was also published in the Python Cookbook (2nd Edition) as recipe 
19.4: "Unpacking a Few Items in a Multiple Assignment".

As mentioned in the recipe, the original discussion was here:
    http://mail.python.org/pipermail/python-dev/2002-November/030380.html
The last message posted on the thread was from GvR, who was against it:
    http://mail.python.org/pipermail/python-dev/2002-November/030437.html

Cheers,


/larry/



More information about the Python-ideas mailing list