[Python-ideas] PEP 484 (Type Hints) -- first draft round

Petr Viktorin encukou at gmail.com
Fri Jan 16 22:08:12 CET 2015


"On Fri, Jan 16, 2015 at 6:17 PM, Guido van Rossum <guido at python.org> wrote:
> After a long editing process we've got PEP 484 (Type Hints) ready for your
> review. This is by no means final, and several areas are either open (to be
> resolved in a later draft) or postponed (to a different PEP altogether). But
> there's enough meat that I think we can start having the discussion. Please
> also see PEP 483 (The Theory of Type Hint; copied and reformatted from the
> original Quip document that I posted just before last Christmas) and PEP 482
> (Literature Overview for Type Hints, by Łukasz). Those are informational
> PEPs though; the actual spec is focused in PEP 484 (the only one on the
> Standards Track).
>
> As I said earlier, I hope to have a rough consensus before PyCon and working
> code (just the typing.py module, really) committed to CPython before the
> last 3.5 alpha.
>
> Here is the raw text of PEP 484. Fire away!!

[...]
> * Tuple, used as ``Tuple[index0_type, index1_type, ...]``.
>   Arbitrary-length tuples might be expressed using ellipsis, in which
>   case the following arguments are considered the same type as the last
>   defined type on the tuple.

How would Tuple[...] or Tuple[t1, ..., t2] work? The PEP should say
such shenanigans are undefined, rather than leave it to
interpretation.

Also, does the empty tuple match Tuple[int, ...]?

[...]
> * WINDOWS
>
> * UNIXOID, equivalent to ``not WINDOWS``

I wonder what the use cases are here. Is this useful, as a dichotomy,
outside of asyncio (or other low-level stdlib code)?


More information about the Python-ideas mailing list