PEP 318: Is chaining decorators even possible?

Kevin Smith Kevin.Smith at sas.com
Thu Jun 12 08:03:45 EDT 2003


It has been brought up a couple of times in other threads that simply 
chaining descriptors won't work (i.e. classmethod(synchronized(foo))).  
Another possibility was to use subclassing (i.e. type('newtype',(
classmethod,synchronized,{})(foo)).  When I wrote PEP 318, I wasn't sure 
myself if it was possible to chain them, but I figured someone would 
point it out if it wasn't.  So my question is, is it even possible to 
chain decorators in a general way?  If not, then PEP 318 might have to 
be changed to only allow one decorator.  This would definitely reduce 
the amount of discussion since the proposed syntax would be reduced to 
'def foo(self) as <callable>:'.

-- 
Kevin Smith
Kevin.Smith at sas.com




More information about the Python-list mailing list