[Python-Dev] replacing 'global'
Guido van Rossum
guido at python.org
Tue Oct 28 10:27:45 EST 2003
More information about the Python-Dev mailing list
Tue Oct 28 10:27:45 EST 2003
- Previous message: [Python-Dev] replacing 'global'
- Next message: [Python-Dev] replacing 'global'
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> Augmented assignment does not currently automatically invoke a > "global" definition now, so why should that change no matter the > outcome of this discussion? Because of the fair user expectation that if you can write "x = x + 1" you should also be able to write "x += 1". > Is there really any need to allow anything more then replicating the > search order for variable _reference_? Code which nests sufficient > scopes that a simple 'inside-out' search is not sufficient would > just seem sorely in need of a redesign to me. . . I just realized one thing that explains why I prefer explicitly designating the scope (as in 'global x in f') over something like 'nonlocal'. It matches what the current global statement does, and it makes it crystal clear that you *can* declare a variable in a specific scope and assign to it without requiring there to be a binding for that variable in the scope itself. EIBTI when comparing these two. --Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] replacing 'global'
- Next message: [Python-Dev] replacing 'global'
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list