this work, (a, (b[2], c)) = ('big', ('red', 'dog')) but this not (a, (b[2], c)) += ('big' ('red', 'dog'))
paul bedaride On Thu, May 29, 2008 at 6:52 AM, <[EMAIL PROTECTED]> wrote: > Indeed. Thank you, Guido. > > On 5/28/08, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > Apart from the missing comma after 'big' this is already supported. > > > > The time machine strikes again! > > > > --Guido > > > > On Wed, May 28, 2008 at 6:23 PM, Daniel Wong <[EMAIL PROTECTED]> > wrote: > >> 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<http://inst.eecs.berkeley.edu/%7Ecs164/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/guido%40python.org > >> > > > > > > > > -- > > --Guido van Rossum (home page: > > http://www.python.org/~guido/<http://www.python.org/%7Eguido/> > ) > > > _______________________________________________ > 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/paul.bedaride%40gmail.com >
_______________________________________________ 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