Skip to content

Commit a7e294d

Browse files
JelleZijlstragvanrossum
authored andcommitted
PEP 484: Add implicit promotions for Python 2.7 (#245)
This was discussed in python/typeshed#270 (comment). Both mypy and pytype behave as described already. We should document this behavior in the PEP to make sure people are aware of it and promote uniformity. Mypy also implicitly promotes bytearray to bytes in both Python 2 and 3. Not sure if that's worth codifying in the PEP too. @vlasovskikh Is this also OK for PyCharm?
1 parent de15fb5 commit a7e294d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pep-0484.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2126,6 +2126,9 @@ Notes:
21262126
'''Docstring'''
21272127
# # type: () -> None # This is OK
21282128

2129+
When checking Python 2.7 code, type checkers should treat the ``int`` and
2130+
``long`` types as equivalent. For parameters typed as ``unicode`` or
2131+
``Text``, arguments of type ``str`` should be acceptable.
21292132

21302133
Rejected Alternatives
21312134
=====================

0 commit comments

Comments
 (0)