[Python-Dev] replacing 'global'
Phillip J. Eby
pje at telecommunity.com
Sun Oct 26 11:06:10 EST 2003
More information about the Python-Dev mailing list
Sun Oct 26 11:06:10 EST 2003
- Previous message: [Python-Dev] replacing 'global'
- Next message: [Python-Dev] replacing 'global'
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
At 04:54 PM 10/26/03 +0100, Just van Rossum wrote: >My question above is misleading with respect to my personal feelings >about the issue. It should have been: > >"""*If* we decide we need to be able to assign to names in outer scopes, >would it be a good idea to add a rebinding operator?""" > >I actually don't care much whether the cability is added or not, but >*if* we add it, I'd much rather see a rebinding operator than an >extension to the global statement or a new declarative statement. If we have a rebinding operator, I'd rather it be something considerably more visible than the presence or absence of a ':' on an assignment statement. So far, all the examples have been downright scary in the invisibility of what's happening. Mostly, I can imagine some poor sap trying to debug a program that uses := and is missing one somewhere or has one where it's not intended -- and hoping that poor sap won't be me. :) I've mostly stayed out of this discussion, but so far something like the scope(function).variable proposals, with perhaps a special case for scope(global) or scope(globals) seems to me like the way to go. It seems very Pythonic, in that it is explicit and calls attention to the fact that something special is going on, in a way that ':=' does not. And 'scope' can be looked up in a manual more easily than ':=' can. Last, but not least, ':=' looks enough like normal assignment in other languages, that somebody just plain might not notice that they *need* to look it up.
- 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