
Oct. 21, 2003
9:57 p.m.
At 02:04 PM 10/21/03 -0700, Guido van Rossum wrote:
Argh, someone *could* pass around a copy of locals() and make an assignment into that.
Not when the locals() is that of a CPython function, and I expect the same is true of Jython functions.
But I think we're already deprecating non-read-only use of locals(), so I'd like to ban that as abuse.
FWIW, both Zope 3 and PEAK currently make use of 'locals()' (actually, sys._getframe()) to modify locals of a class or module scope (i.e. non-functions). For both class and module scopes, it seems to be implied by the language definition that the local namespace is the __dict__ of the corresponding object. So, is this deprecated usage for class and module objects too?