[Python-ideas] PEP-3150
Carl M. Johnson
cmjohnson.mailinglist at gmail.com
Thu Apr 14 07:46:45 CEST 2011
On Wed, Apr 13, 2011 at 3:48 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On Thu, Apr 14, 2011 at 8:33 AM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
>> assigned to the __doc__ attribute of whatever object the
>> RHS expression returns.
>
> Ah, true, that would make a lot of sense. It also generalises nicely
> to other cases like "return" and "yield" as well. I'll see if I can
> thrash out something sensible along those lines.
So, in the case of
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? I guess I can kind of see the reasoning there, but it
seems a little weird.
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. But would that just add needlessly to the complexity
of the language?
-- Carl
More information about the Python-ideas
mailing list