[Python-Dev] Re: PEP 318: Decorators last before colon
Jeff Kowalczyk
jtk at yahoo.com
Wed Mar 31 12:29:49 EST 2004
Jeremy Hylton wrote:
> Another possibility that has been suggested is
> [decorator]
> def func(arg, arg):
The decorator before def spelling is familiar from C#, and
looks the nicest to me. However, I'm curious about the way
decorators differ from docstrings to explain putting one
kind of metadata shorthand before def and the other after.
[decorator]
def func(arg, arg):
"""Docstring"""
pass
def func(arg, arg):
[decorator]
"""Docstring"""
pass
If there will only ever be two of these kinds of things,
and a consensus is to put them on lines before and after
the def, that would seem to be reason enough for
decorator before def.
If someday there were other types of metadata distinct
from decorators, perhaps immutable and pertaining to
secure execution, the before-docstring spelling might
allow for more consistent additions to the shorthand.
def func(arg, arg):
[decorator]
(otherator)
"""Docstring"""
pass
More information about the Python-Dev
mailing list