On Mon, Aug 25, 2014 at 3:20 AM, Ed Kellett <edk141@gmail.com> wrote:
>
> On 25 August 2014 07:18, Terry Reedy <tjreedy@udel.edu> wrote:
> > On 8/24/2014 11:12 PM, Guido van Rossum wrote:
> >
> >> Finally, I would actually be okay if we found a way to let type hints
> >> and other annotations coexist -- I just prefer type hints to be the
> >> default use, since I see them as much more generally useful than all
> >> other uses combined.
> >
> >
> > I believe co-existence is possible, but the details will depend on the form
> > type hints take. First, other annotations should be easily distinguished
> > from type hints. Second, other annotations that would interfere with the
> > runtime use of __annotations__ should be pulled out by a decorator and
> > possibly moved to another attribute specific to the decorator (such as
> > '_deco_name').
>
> … or we could have a decorator for type hints, and ascribe no new
> meaning at all to __annotations__. Or assume __annotations__ contains
> type hints iff all the annotations present are instances of typing.*.
> That might be better anyway, since a decorator could then add (or
> augment) type information without assigning to __annotations__ (which
> would be weird).
>
> Even if conveying type information is the most useful use of
> annotations, there's no reason it can't be explicit (and consistent
> with other uses of annotations).

All that sounds fine, but you still have to have a way to convey all that information to the type checker. Remember, the type checker cannot (or doesn't want to) execute the code and it can only see annotations in their original syntactic form. (But it can indeed be told about certain decorators.)

--
--Guido van Rossum (python.org/~guido)