On Wed, Jul 21, 2010 at 8:53 PM, Guido van Rossum firstname.lastname@example.org wrote:
On Wed, Jul 21, 2010 at 11:39 AM, Masklinn email@example.com wrote:
On 2010-07-21, at 02:09 , Carl M. Johnson wrote:
1.) It looks like a lot of the complexity of PEP 3150 is based on wanting thing like this to work:
x[index] = 42 given: index = complicated_formula
To make that work, you need to figure out if index is a nonlocal or a global or what in order to emit the right bytecode. What happens if we just give up that use case and say that anything on the assignment side of the initial = gets looked up in the original namespace? In other words, make 3150 more similar to the sugar:
Why do you think it's more complicated to do it for the LHS than for the RHS?
It's allowing more than simple names on the LHS that makes a naive return-based approach to name binding not work.
However, it's class scopes that really make this complicated, and making it "just work" is probably easier than trying to explain which kinds of assignment will and won't work.