[Python-3000] Use cases for type annotations? (WAS: Type parameterization)

Steven Bethard steven.bethard at gmail.com
Sun May 21 02:00:34 CEST 2006


On 5/20/06, Guido van Rossum <guido at python.org> wrote:
> On 5/20/06, Steven Bethard <steven.bethard at gmail.com> wrote:
> > I guess in the end, I'm still a little confused at why we're having a
> > syntax discussion now.  If type annotations are just an extra
> > expression in a function definition, why does Python  core care about
> > what syntax a system like Phillip's or Collin's chooses?  That is,
> > isn't the ``dict[str, int]`` or ``{str: int}`` syntax decision just a
> > decision for the ``typecheck`` or ``overloading`` module, and not for
> > Python in general?
>
> It is indeed up to the framework, not up to Python.
>
> However we might as well give some guidance, and e.g. parameterized
> types a la list[int] (or ImmutableSequence[Number]) is my proposal
> *if* I were asked to design a sub-language for expression type
> constraints.
>
> Also, if we want IDEs to use this (e.g. for name completion) we should
> have agreement on the syntax.

So in the end, the goal of this discussion is something along the
lines of an informational PEP, ala the Database API or WSGI, that
would provide suggested guidelines for type annotation expressions.

Thanks for the clarification.  I think I'm going to re-read these
threads now. ;-)

STeVe
-- 
Grammar am for people who can't think for myself.
        --- Bucky Katt, Get Fuzzy


More information about the Python-3000 mailing list