[Python-ideas] Attribute Docstrings and Annotations

Josiah Carlson jcarlson at uci.edu
Tue Jan 2 18:21:31 CET 2007

Tony Lownds <tony at pagedna.com> wrote:
> On Jan 1, 2007, at 10:21 PM, Josiah Carlson wrote:
> > I have never needed attribute annotations, and I've never heard any  
> > core
> > Python developer talk about it being useful to have them.  -1 for the
> > feature in any form.
> > The syntax as described is ugly.  -100 for the feature if it has the
> > syntax provided.
> >
> It's the same syntax as function annotations...
> def f(name: annotation = value):
>        ^^^^^^^^^^^^^^^^^^^^^^^^

I don't particularly like the look of function annotations either, but I
don't have a better syntax (aside from swapping the annotation and value).
In this case, I really don't like attribute annotations because it
looks to me like a bunch of line noise without meaning, or some C-like
conditional expression gone wrong.

> class F:
>      name: annotation = value
>      ^^^^^^^^^^^^^^^^^^^^^^^^
> The syntax was presented on Guido's blog, too.
> http://www.artima.com/weblogs/viewpost.jsp?thread=87182

I didn't like it when Guido posted it on his blog either.  I would also
point out that Guido lists attribute annotations as a "maybe".  Perhaps
he has become 100% on them, I don't know, but I'm still -1.

In any case, you still haven't provided any use-cases, or an example
where developers have been asking for the feature and could show that
*not* having the feature was constraining them in some significant way.

 - Josiah

More information about the Python-ideas mailing list