-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Bad typing for Python 2.7 with unicode_literals
#5098
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Did I mention that from __future__ import unicode_literals is a bad idea?
…On Tue, May 22, 2018, 18:25 Ilya Konstantinov ***@***.***> wrote:
Consider:
from __future__ import unicode_literalsimport sys
print(sys.modules['sys'])
mypy --py2 unicode_literals.py results in:
unicode_literals.py:4: error: Invalid index type "unicode" for "Dict[str, Any]"; expected type "str"
However, python2.7 unicode_literals.py results in:
<module 'sys' (built-in)>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#5098>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACwrMoeZNPfQ5wVeufJE9eiWTZP6daDfks5t1LqigaJpZM4UJoIb>
.
|
I believe mypy currently doesn't support unicode_literals: there's some related discussion here and here. Maybe there's an opportunity to do some usability enhancement here? If we're not planning on supporting unicode_literals any time soon, maybe we can have mypy report a warning when it detects some code using it/link to something in the docs. |
Oh, that is a great idea!
…On Tue, May 22, 2018, 19:09 Michael Lee ***@***.***> wrote:
I believe mypy currently doesn't support unicode_literals: there's some
related discussion here <#3619> and
here <#2536>.
Maybe there's an opportunity to do some usability enhancement here? If
we're not planning on supporting unicode_literals any time soon, maybe we
can have mypy report a warning when it detects some code using it/link to
something in the docs.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#5098 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACwrMgXTaepPwT0aDgb-26nnGUhWCblMks5t1MTcgaJpZM4UJoIb>
.
|
This is essentially a duplicate of #2536, so I am closing this one. |
Consider:
mypy --py2 unicode_literals.py
results in:However,
python2.7 unicode_literals.py
results in:The text was updated successfully, but these errors were encountered: