[Python-ideas] Default decorator?

Ryan Freckleton ryan.freckleton at gmail.com
Thu Jan 17 02:33:04 CET 2008

+1 from me. But I'm just a ignorant python end-user :-) I imagine it
would probably end up being used like the __metaclass__ module hook is

On Jan 16, 2008 6:05 PM, Christian Heimes <lists at cheimes.de> wrote:
> Does a default decorator also decorate nested functions (function with
> functions)? And does it also decorate class members or function created
> with exec()? What about lambda?

The __metaclass__ hook currently changes the metaclass for nested
classes, the decorator hook could follow the same semantics:

>>> class Foo(type):
...     pass
>>> __metaclass__ = Foo
>>> class C:
...     class D:
...             pass
>>> type(C)
<class '__main__.Foo'>
>>> type(C.D)
<class '__main__.Foo'>

Lambdas don't currently support parameter annotations, so they should
be left out.

--Ryan E. Freckleton

More information about the Python-ideas mailing list