[Python-3000] Type annotations

Guido van Rossum guido at python.org
Tue May 23 17:12:49 CEST 2006


On 5/22/06, Talin <talin at acm.org> wrote:
> Guido van Rossum wrote:
> >>Perhaps we should go with Tony Lownds' suggestion of tuple[T] is an
> >>arbitrary-length tuple and tuple[T,] is a 1-tuple?
> >
> >
> > Looks pretty ugly to me. I suggest you STOP WORRYING about this for a
> > while and finish the rest of the PEP.
>
> At this point, I have to admit that I've completely lost track of the
> discussion (and I've read all the messages) - what exactly is it that
> we're trying to accomplish here?
>
> Would some kind person please do me a favor and summarize what the
> issues being put forward are? Thanks.

I think that Collin's agenda and mine are slightly different. Collin
wants something like his type checking decorators to be in the stdlib
(but he's okay to switching to my syntax proposal e.g. list[int] or
Sequence[Number]). I'm not sure that I want that but I also don't want
to prevent him from doing it if it can be pulled off. My own agenda is
first to get a PEP written about the parameter and return value
annotation syntax, *without* any semantics (other than making the
expression available via __signature__, which is a separate PEP).

Bill Janssen wants to go further than Collin; he wants sequence-ness,
file-ness,  etc. to be expressed by explicit subclassing. I'm at the
point where I think that some kind of explicit marker to distinguish
sequence-ness from mapping-ness is a good idea, but I'm not sure if it
should be inheritance or a marker attribute/method, and I'm not sure
that we should do this for all container types. But I'm open to
someone coming up with a coherent type hierarchy for Python and a way
to formalize it a bit mor without losing duck typing.

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


More information about the Python-3000 mailing list