[Python-ideas] Attribute Docstrings and Annotations

Guido van Rossum guido at python.org
Tue Jan 2 19:41:46 CET 2007


Yes, I blogged about it, but in the discussion that followed on
python-3000 it became clear that the "typed attribute" notation is not
a favorite of many folks, and I'm no longer in favor of it myself. The
use cases are a lot weaker than for signature annotations. So let's
drop it.

On 1/2/07, Tony Lownds <tony at pagedna.com> wrote:
>
> On Jan 2, 2007, at 9:21 AM, Josiah Carlson wrote:
>
> >
> > 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.
>
> As long as it's clear that the syntax as proposed has SOME existing
> thought
> behind it, I'm happy to leave the proposal alone.
>
> -Tony
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-ideas mailing list