[Python-ideas] Javascript Destructuring Assignment

Talin talin at acm.org
Mon Mar 5 23:40:55 CET 2007

As you probably know, the next version of Javascript (1.7) will have a 
number of ideas that have been borrowed from Python. In particular, the 
"tuple assignment" syntax will now be supported in Javascript, which 
will be a pleasant addition to the language.

However, I noticed that the Javascript version is, in some respects, a 
superset of the Python functionality.

If you are interested, you might have a look at this page:


Go to the section called "Destructuring assignment" to check out how the 
new syntax is going to work.

As an example of what I mean, the Javascript unpacking syntax will allow 
variables to be skipped:

   [a,,b] = [1,2,3]

In other words, a is assigned the value 1, the value 2 is thrown away, 
and b is assigned the value 3. In today's Python, this requires a dummy 

I admit that this is not a particularly important feature; However, 
given that Javascript is being inspired by Python in this case, maybe it 
would be appropriate to return the favor?

-- Talin

More information about the Python-ideas mailing list