Bulk Adding Methods Pythonically

Random832 random832 at fastmail.com
Thu Jun 16 12:15:08 EDT 2016


On Wed, Jun 15, 2016, at 15:03, Ethan Furman wrote:
> [1] https://docs.python.org/3/library/functions.html#locals
>      Yes, returning the class namespace is a language gaurantee.

How do you get a guarantee from that text? I don't see any definition
asserting that the "current local symbol table" is the class namespace
(more specifically, the object returned by (metaclass).__prepare__,
which will be copied into [not used as, for normal types]
(class).__dict__). We *know* that "representing the current local symbol
table" can and often does mean "copied from the local symbol table which
is not a in fact a dictionary" rather than "being the local symbol table
which is a real dictionary object" (that's *why*, after all, updating
locals() doesn't work in the general case), nor does it mention any
exemption to the warning about updating it.

If there's a guarantee of this, it's somewhere else.


More information about the Python-list mailing list