packing unpacking depends on order.

Sven R. Kunze srkunze at mail.de
Thu Sep 3 19:25:08 EDT 2015


On 03.09.2015 03:17, random832 at fastmail.us wrote:
>
> The question is what does "assign it to the left side at once" even
> *mean* in the presence of subscripts? Build up a list of
> object-subscript pairs (evaluating all the subscripts, including if any
> may have side effects) before executing any __setitem__?

I think Ian described how it could be done.

> Why is the right side evaluated first?

Because that's how things normally work. Evaluate the RHS and assign the 
value to the LHS.

Currently, the generalization of a simple assignment is more like 
hopping back and forth around the "=".

You mentioned side-effects. That is true. Right now, however, the 
side-effects even fire back to the RHS of the assignment. That is really 
weird. To me, and as it seems to some other folks here, the RHS should 
be at least independent of the LHS and vice versa.

Both sides may have side-effects, but at least independently from each 
other. That's at least how I feel about it.

Best,
Sven



More information about the Python-list mailing list