explicit variable scoping
sross at connectmail.carleton.ca
Mon Mar 22 21:22:14 CET 2004
"David MacQuigg" <dmq at gain.com> wrote in message
news:blbu505vrj35i52ari8a0uivja0pp7a9qu at 4ax.com...
> If we want to set variables in intermediate scopes, I would prefer a
> syntax like:
> b = 1
> def f():
> a = 2
> def g():
> global.f.a = 3
> global.b = 4
> Of course, this means we also have to allow functions to have
I know what you meant but, technically, functions can and do have
attributes, just not the kind you've mentioned (where the locals become
attributes of their function):
>>> def f(): pass
>>> f.a = "A"
Just so things are clear for those following along ...
More information about the Python-list