[Python-ideas] Default decorator?

Aaron Brady castironpi at comcast.net
Thu Jan 17 02:13:52 CET 2008


> -----Original Message-----
> From: python-ideas-bounces at python.org [mailto:python-ideas-
> bounces at python.org] On Behalf Of Christian Heimes
> 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?

__decor__= functools.partial( "when?" )
__lambdadec__= functools.partial( "say when." )
__classdec__= functools.partial( "now." )
__classmethoddec__= functools.partial( "ooh.  too much." )

or:

from functools import partial
__decor__= funcutils.ModuleDec( partial( "where?" ), lambdadec= partial(
"there." ), classmethdec= partial( "never." ) )





More information about the Python-ideas mailing list