pep-318 questions

AdSR artur_spruce at yahoo.com
Tue Aug 10 18:46:18 EDT 2004


Skip Montanaro <skip at pobox.com> wrote in message news:<mailman.1465.1092157434.5135.python-list at python.org>...
> <snip>
> I think Guido pronounced on this over the weekend.  He stated that
> decorators don't belong indented with the code, even at the beginning.  In
> fact, he commented that in retrospect he feels that doc strings belong
> outside the function as well.  (Of course, that would present a practical
> conflict between a module's doc string and that of the first executable code
> in the module file should it happen to be a function definition.  But I
> digress...)

The nice thing about the @decor syntax is that it might be easy to
extend it to @"""Docstring""" - "decorate" a function (or class) with
the docstring if the decorator expression is a string literal instead
of an expression.

I prefer in-body docstrings though. While function decorators should
be well visible - they may do important changes to function's behavior
- the docstring is of secondary importance, only needed when we don't
know/remember what the function/class does (and hence should also fold
easily in a folding editor).

> <snip>
> Nobody has so far been able to come up with a single keyword that seems to
> connote "this is a decorator function that is to be applied to the next
> function definition".

And '@' does good job of it - it stands out well. Plus, it's a
decorated 'a' in many fonts :)

AdSR



More information about the Python-list mailing list