[Python-Dev] pep 318, Decorators for Functions, Methods and Classes

Jack Diederich jack at performancedrivers.com
Wed Aug 11 03:11:16 CEST 2004


On Sat, Aug 07, 2004 at 02:05:14PM -0700, Guido van Rossum wrote:
> > I just wanted to say that I believe it should be allowed to decorate
> > classes. There's not reason enough (reading the thread linked to by the
> > PEP) to limit decorators this way. Like said several times in that
> > thread, metaclasses are harder (to write and to understand) than
> > decorators.
> > 
> > Also, considering that you said you would have actually wanted
> > docstrings above the definition of a function, wouldn't this apply
> > to classes as well?
> > 
> > Anyway, it's an artificial limit and it would be better to be able
> > to test it out during the alpha.
> 
> Are you volunteering to implement it?
> 

I'm game, I would prefer to use class decorators in most of the places
I currently use metaclasses.  I dropped the original patch author (Mark
Russel) an email yesterday after looking through the 4kloc patch fishing
for advice.

If someone would clue me in on which files are generated and which
ones need to be done by hand it would be a big help.  It wasn't obvious
to me (other than compile.c and tokenizer.c) on first reading.

TIA,

-Jack


More information about the Python-Dev mailing list