[Python-ideas] PEP-3150
Greg Ewing
greg.ewing at canterbury.ac.nz
Thu Apr 14 10:06:36 CEST 2011
Carl M. Johnson wrote:
> def decorator(f):
> return decorated given:
> "Docstring A..."
> def decorated(*args, **kwargs):
> "Docstring B..."
> do something...
>
> it would be docstring A that gets put on the decorated function, not
> docstring B?
That seems like a contrived example. If you wanted the
function to have Docstring B, why did you give the given
block a docstring of its own in the first place?
> Also, this case (and the general issue of callbacks, thunks, etc.)
> seems to be crying out for a special convenience syntax to save a
> level indenting.
In this particular case (i.e. a function that does nothing
but define and return another function) I'd like to be able
to write
def decorator(f)(*args, **kwargs):
do something...
but that's a subject for another hotly-debated PEP!
--
Greg
More information about the Python-ideas
mailing list