[Python-Dev] replacing 'global'
Neal Norwitz
neal at metaslash.com
Sat Oct 25 10:29:32 EDT 2003
On Sat, Oct 25, 2003 at 04:03:17PM +0200, Alex Martelli wrote:
>
> Yes! If the compiler needs to be aware of global assignments (which IS
> a good idea) we can do so by either introducing a new "operator keyword"
One thing that I've always wondered about, why can't one do:
def reset_foo():
global foo = [] # declare as global and do assignment
As Alex pointed out in another mail (I'm paraphrasing liberally):
redundancy is bad. By having to declare foo as global, there's
a guaranteed redundancy of the variable when foo is also assigned.
I don't know if this solution would make Alex dislike global less.
But it changes global to look more like a statement, rather than
a declaration.
Neal
More information about the Python-Dev
mailing list