Hi,

Are there plans for introducing syntax like this:

(a, (b[2], c)) = ('big' ('red', 'dog'))

It seems quite doable, because Professor Hillfinger at UC Berkeley
created pyth, a dialect of Python, which has this feature. See page 10
of the spec he created for his students to implement the language:

http://inst.eecs.berkeley.edu/~cs164/sp08/docs/pyth.pdf

Of course, this idea could also be applied to 'for' constructs (loops,
list comprehensions, and generators) where assignments are implicit.

Parallel looping (esp using zip) is a great use case for this. Here's
a case that's come up more than once for me that "structured"
assignments would solve really nicely:

for n, (a, b) in enumerate(list_of_pairs): ...

Currently, I must do the following instead:

for n, pair in enumerate(list_of_pairs):
  a, b = pair
  ...

This isn't such a great solution, because there's more indirection
with the introduction of an otherwise useless variable; and (less
significantly) there's an extra line of code that doesn't actually
compute anything.

Thoughts?

Daniel

PS: Sorry if this has already been discussed; I'm new to this list and
I didn't see this mentioned in PEP 3099, unless it's covered under the
LL(1) clause.
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to