[Python-Dev] Remove typing from the stdlib

Paul Moore p.f.moore at gmail.com
Fri Nov 3 16:34:14 EDT 2017

On 3 November 2017 at 17:00, Steve Dower <steve.dower at python.org> wrote:
> I'm torn.
> If not having typing installed means you can't use "Any" or "Optional" in an
> annotation, that basically kills the whole thing. Some primitives need to be
> there.

Thinking some more about this, I think that it's now established that
the annotation syntax is for types - any debate over other uses for
them is now past. As a result, though, I think it's important that the
language (and/or the standard library) should include support for
*expressing* those types. The typing module is what allows users to
express types like "list of integers", or "optional string", or
"iterable", and if we move typing out of the stdlib, we make it
impossible for people who want to use the language feature to do so
from within the core language.

Consider someone who's downloaded Python and PyCharm (or Visual
Studio). They want to get the benefit of the IDE code completion
facilities, so they declare their argument as List[int], following the
information they've found on how to declare lists of integers. And now
their code won't run, until they install typing from PyPI. And there's
no workaround, because you can't express List[int] in the core
language/stdlib. That's not a very good start for a newcomer to

I'm fine with the "advanced" bits of typing being removed from the
stdlib, but I think we need to include in the stdlib at least enough
to express the basic types of the language (including common
combinations such as Optional and Union).


PS Apologies if I've misunderstood any of the technical aspects of
typing - I'm happy to be corrected. As I said in another email, I've
not actually used type annotations in my own code yet, although I'm
thinking of starting to - precisely because I've been using PyCharm
recently and the IDE support when you declare types is quite nice.

More information about the Python-Dev mailing list