[Python-Dev] Class decorators

Fred L. Drake, Jr. fdrake at acm.org
Fri Mar 31 20:48:50 CEST 2006


On Friday 31 March 2006 11:52, Phillip J. Eby wrote:
 >      class bar:
 >          @class foo
 >          def __init___(...):
 >              ...

The more I think about it, the more I like the "@class foo" syntax.  The 
existing syntax for functions doesn't have anything between the decorators 
and the "def"; having class decorators embedded within the class should still 
allow the docstring to be the first thing, so there's more distance between 
the decorator and the name being decorated.  The extra hint about what's 
being decorated is nice.


  -Fred

-- 
Fred L. Drake, Jr.   <fdrake at acm.org>


More information about the Python-Dev mailing list