[Python-3000] What's the point of annotations?

Collin Winter collinw at gmail.com
Wed Jan 3 20:00:31 CET 2007


On 1/3/07, Phillip J. Eby <pje at telecommunity.com> wrote:
> At 11:06 AM 1/3/2007 -0600, Collin Winter wrote:
> >PS: I think it's interesting how nearly all the use-cases mentioned
> >involve adding type information to functions.
>
> Um, yeah, that was kind of the idea.  :)

I mention that as an amusing contrast to the "you could use
annotations for *anything*!" tone of the latter discussions and the
PEP.

> Note, however, that Java
> annotations (the place we stole the "@" sign from) can be applied to
> arguments as well as to methods and classes, and they *already* have the
> type information without needing annotations!  So, you might look to see
> what *else* they use it for, besides documentation and IDE hints.  I
> haven't done any Java work in a long time, myself.

I've never done any serious Java work, but the examples Google has
turned up seem to focus on working around limitations in Java's
reflection and type systems. What were you thinking of?

> (The problem with your approach to this, though, is that basically you
> still just keep complaining that each use case could be done some other
> way.  Of course they can.  That's not the point.  Might as well argue that
> we don't need both mappings *and* objects with attributes, because
> JavaScript gets by with combining the two.)

No, my point is that not every n-line function needs to be made into syntax.

Collin Winter


More information about the Python-3000 mailing list