[Python-ideas] Attribute Docstrings and Annotations (original) (raw)

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: exprstmt: test (':' test ['=' (yieldexpr|testlist)] | augassign (yieldexpr|testlist) | [',' testlist] ('=' (yieldexpr|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.



More information about the Python-ideas mailing list