Currently using from __future__ import unicode_literals in Python 2 is kind of painful with mypy. Here are some potential issues:
- Some typeshed stubs declare things to only accept
str arguments, when in reality they also accept at least ascii-only unicode objects.
- Mypy might not accept the implicit
unicode literals in every context where a literal has a syntactic role (outside normal expressions), and b'foo' literals won't work in Python 3. String literal type escaping is an example.
It's fair to argue that using unicode_literals is a bad idea, but it's not uncommon to encounter real-world code using that, so getting mypy to work with it might be at least somewhat important.
Currently using
from __future__ import unicode_literalsin Python 2 is kind of painful with mypy. Here are some potential issues:strarguments, when in reality they also accept at least ascii-onlyunicodeobjects.unicodeliterals in every context where a literal has a syntactic role (outside normal expressions), andb'foo'literals won't work in Python 3. String literal type escaping is an example.It's fair to argue that using
unicode_literalsis a bad idea, but it's not uncommon to encounter real-world code using that, so getting mypy to work with it might be at least somewhat important.