Python 3000 idea: reversing the order of chained assignments

Terry Reedy tjreedy at udel.edu
Thu Mar 22 00:45:14 CET 2007


"Marcin Ciura" <marcin.ciura at poczta.NOSPAMonet.pl> wrote in message 
news:etscd5$g0g$1 at news.onet.pl...
| Neither would I. I must have expressed myself not clearly enough.
| Currently
| x = y = z
| is roughly equivalent to
| x = z
| y = z

except that z is only evaluated once.

| I propose to change it to
| y = z
| x = z

Unless target expression expressions interact, there is no difference. 
When there are such side effects, I think it best to be explicit about what 
you want to happen first, as in your original code, instead of trying to 
mash them together in one line.

Terry Jan Reedy






More information about the Python-list mailing list