[Python-Dev] PEP 318: Suggest we drop it

Kevin J. Butler python-kbutler at sabaydi.com
Wed Aug 18 23:33:14 CEST 2004


- There is no universally liked syntax (or even a universally 
_tolerable_ syntax)
- decorators will incosistently retain or drop docstrings (this may even 
be the most appropriate thing to do)
- a "decorated" function may have an arbitrarily distant relationship 
with the function as implemented in the def statement (this is a killer)
- if you want to decorate a single function two separate ways, you're 
back to 2.3 syntax - say, one that logs, checks parameters, etc., and 
the "internal" optimal version. None of the decorator syntaxes 
facilitate this.

Because of all these issues, I think we should drop PEP 318.

The 2.3 form seems more reasonable all the time:

def __func( self ):
    pass
spanishInquisition = mydecorator( __func )
spanishInquisition.__doc__= """Something unexpected"""

parrot = otherdecorator( __func )
parrot.__doc__ = """And now for something completely different"""

Are any of the syntaxes enough better to justify the irritation or 
divisiveness of including it?

Syntactic sugar causes cancer of the semicolon, indeed...

kb


More information about the Python-Dev mailing list