Python 3000 idea: reversing the order of chained assignments

Duncan Booth duncan.booth at invalid.invalid
Thu Mar 22 09:30:19 EDT 2007


Steve Holden <steve at holdenweb.com> wrote:

> Help me out here. It looks as though the real syntax should 
> be something like
> 
> assignment_stmt       ::=       (target_list "=")+ expression_list |
>                                  (target_list "=")+ assignment_stmt

That is precisely the point. If it was:

assignment_stmt       ::=       (target_list "=") expression_list |
                                 (target_list "=") assignment_stmt

(i.e. removing the '+' which your eyes jumped over)
then the actual assignments would have to apply right to left with each 
assignment giving the result for the next one.

But since it is:

assignment_stmt       ::=       (target_list "=")+ expression_list

the repeated target lists may be expected, and are indeed defined, to 
assign left to right.



More information about the Python-list mailing list