Are decorators really that different from metaclasses...

Anthony Baxter anthonybaxter at gmail.com
Thu Aug 26 17:18:23 CEST 2004


On Thu, 26 Aug 2004 11:09:28 -0400, Paul Morrow <pm_mon at yahoo.com> wrote:
> The function does *not* get a new namespace!  Let me stress this point a
> little further.  We would simply be moving __xxx__ variables *out of*
> the function's local variable namespace to where they belong, the
> namespace of the function itself --- /the same namespace that __doc__
> lives in./

There _is_ _no_ _such_ _namespace_. __doc__ is an attribute of the
function object.

You are proposing to add one. How else is __doc__ = __doc__ + 'extra' to work? 

Please, please look into how python's namespaces work a bit more. This
isn't super-complex stuff, and the lovely thing about Python is that
it's _really_ easy to use introspection to see how these things work.



More information about the Python-list mailing list