bwinton at latte.ca
Wed Mar 7 01:15:24 CET 2007
(re-sending, because I forgot to subscribe first...)
Delaney, Timothy (Tim) wrote:
> Brett Cannon wrote:
>>> Are you assuming variable-length skips, so that
>>> [a,,b] = [1,2,3,4,5] would mean a=1;b=5 ?
>> Yep, that's how I read it.
> I read it differently. I'm think you need to have a comma for each
> skipped element:
> [a,,,b] = [1,2,3,4,5]
> Anyone with in-depth knowledge, or FireFox 2.0 available to test this?
js> [a,b] = [1,2]
js> [a,b] = [1,2,3]
js> [a,,b] = [1,2,3,4,5]
js> [a,,,b] = [1,2,3,4,5]
which is pretty much what I'ld expect. Having said that, it does make
it easy to mess up in exactly the way you messed up in your example...
Also, for the curious:
js> [a,[b,c],d] = [1,2,3,4]
I'ld far prefer it to throw an error if you tried to unpack into a
More information about the Python-ideas