[Python-Dev] Remove typing from the stdlib
brett at python.org
Sun Nov 5 12:45:54 EST 2017
On Fri, 3 Nov 2017 at 17:59 Lukasz Langa <lukasz at langa.pl> wrote:
> > On 3 Nov, 2017, at 4:01 PM, Victor Stinner <victor.stinner at gmail.com>
> > The question is if you would only need <Python 3.7> or <Python 3.7 +
> > pip install typing>.
> > If typing is removed from the stdlib, you can still use it in your
> > application. It's "just" another dependency no?
> The ideal situation is that something is built-in and just works,
> examples: dicts, lists, sorted().
> So, if you have to import it to use it, it's still great but less
> seamless, current example: regular expressions. Let's say Guido suggests we
> should import sorted, dict, and list before use. Not a big deal, right? I
> mean, how many applications do you know that don't use any other imports?
> Finally, if you have to find a third-party package, add it to
> requirements.txt and manage the dependency forward, that's even less
> seamless. The standard library has a pretty conservative approach to
> backwards compatibility. On the other hand, third-party libraries often
> don't. Sure, there's noble exceptions but the general feel is that you need
> to be more careful with dependencies from PyPI. If somebody suggested that
> regular expressions or dictionaries should be moved to PyPI, in my book
> that would suggest strange things will start happening in the future.
> So, the difference is in perceived usability. It's psychological.
I think another psychological side-effect of removing 'typing' is how
strongly people will view the guidance that annotations are generally
expected to be type hints. With 'typing' in the stdlib, it made that
assumption a bit strong, especially if the stdlib ever started to use type
hints itself. But by saying "we expect annotations will be used for type
hints, but we actually don't do that in the stdlib nor provide a mechanism
for actually specifying type hints", that weakens the message. It starts to
feel like a "do as I say, not as I do" bit of guidance (which to me is
different than the worry that the usage of type hints will decrease).
But that might be fine; I personally don't know. But my suspicion is we
will see an uptick of alternative annotation uses that aren't type hints if
we take 'typing' out, and that's something we should be aware of and okay
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-Dev