[Python-ideas] Attribute Docstrings and Annotations
Josiah Carlson
jcarlson at uci.edu
Tue Jan 2 07:21:21 CET 2007
Tony Lownds <tony at PageDNA.com> wrote:
>
> I'd like to propose annotations and docstrings on attributes for
> Python 3000
> with the following Grammar and properties:
>
> expr_stmt: test (':' test ['=' (yield_expr|testlist)] |
> augassign (yield_expr|testlist) |
> [',' testlist] ('=' (yield_expr|testlist))*
> )
[snip]
> >>> class X:
> ... "class docstring"
> ... foo: 1 = 1
> ... bar: 2
> ... "attribute docstring"
> ... attr = None
> ... "another attribute docstring"
> ... fields = __slots__ = ['fields', 'attr']
> ... "docstring ignored"
> ... x, y = 1, 2
> ...
I have never needed attribute annotations, and I've never heard any core
Python developer talk about it being useful to ahve them. -1 for the
feature in any form.
The syntax as described is ugly. -100 for the feature if it has the
syntax provided.
- Josiah
More information about the Python-ideas
mailing list