PEP-0318
Arthur
ajsiegel at optonline.com
Mon Aug 9 07:27:25 EDT 2004
On Mon, 9 Aug 2004 11:34:39 +1000, Anthony Baxter
>Guido has ruled out decorators at the top of function body, on the grounds
>that it looks like something that would be executed as part of the function,
>but isn't. FWIW, in the same thread he's noted that having docstrings where
>they are is problematic in this respect. Fortunately, with the new decorator
>syntax, we can fix this...
>
>def doc(docstring):
> def add_doc_string(func, docstring=docstring):
> func.__doc__ = docstring
> return func
> return add_doc_string
>
>@doc("This function frobulates an input sequence")
>def frob(seq):
> ....
On one hand I find it strange that Gudio would come to this without
much, if any, feedback from the community of users working within the
status quo without raisng an issue. You would think someone other
than Guido would have also expressed some discomfort with the status
quo if it were truly problematic.
On the other hand, when I # comment a function, my instinct has always
been to place the comment directly above the function, rather than in
the body. Which I seem to think is common practice. So I need to
admit that with the freedom to comment anywhere, the fact that
instinct, and nothing but, has led me to place it outside and above
the body perhaps sabotages, a bit, my own and others position that
decorators outside and above the function is somehow unnatural.
Art
More information about the Python-list
mailing list