[Python-Dev] nonlocals() function?

average dreamingforward at gmail.com
Mon Apr 5 21:23:39 CEST 2010


> globals() and locals() return dicts mapping names to objects.

Damn, I totally pulled a *?!* on that one.  I should have pulled out
my Python reference.  I was thinking of dir() and thought that these
functions were similar.  Apologies for that.  However, I still do
believe that as a general practice (not necessarily a Python one),
return types should be the most specific type which will hold the
data.

> I'm not sure why you think that the globals() and locals() ....
> You say
> they should be properties and attributes, but properties of what?

They would be properties of the implicit "main" [function] object.

Sorry again for not checking before opening my "mouth".

marcos


More information about the Python-Dev mailing list