[Python-ideas] Proposal to extend PEP 484 (gradual typing) to support Python 2.7

Random832 random832 at fastmail.com
Fri Jan 22 14:19:24 EST 2016


On Fri, Jan 22, 2016, at 14:08, Guido van Rossum wrote:
> In mypy (and in typeshed and in typing.py), 'str' refers to the type
> named
> str in the Python version for which you are checking -- i.e. by default
> mypy checks in PY3 mode and str will be the unicode type; but "mypy
> --py2"
> checks in PY2 mode and str will be the Python 2 8-bit string type. (This
> is
> actually the only thing that makes sense IMO.)

Why should it need to check both modes separately? Does it not work at a
level where it can see if the expression that a value originates from is
"native" (e.g. a literal with no u/b) or bytes/unicode?


More information about the Python-ideas mailing list