-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
special rules in typeshed pyi #270
Comments
|
Is int <-> long implicit, or does everywhere I have "int" need to be changed to "Union[int, long]"? |
It's implicit. This whole thread is about things that are implicit. (And the |
|
|
Thanks for the clarification! I'll edit the posts above.
That's what pytype used to do. But our internal users were complaining about it, so we now allow None, too. It seems "safe" enough. At least, it's not clear what a false negative would look like. (Maybe a function without a return?) |
Here are some potential cases where
|
Is it worth adding the unicode/str and int/long promotions for Python 2.7 to PEP 484? Does pytype behave differently from mypy? |
I like the idea of specifying promotions in PEP 484. We'd have to have consensus from PyCharm (@vlasovskikh) and pytype (@matthiaskramm). |
+1 |
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?
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. PyCharm already supports these promotions except long -> int. |
All of the examples mentioned here have now been standardized in PEP 484, and we should not be standardizing any other mypy peculiarities in typeshed, so I don't see a reason to keep this open. |
Let's use this issue to track special stub rules that found their way into typeshed stubs. Since mypy is currently the only system used for testing typeshed, it's natural for some mypy logic to become reflected in the typeshed stubs.
So far I have:
(I'll add these to
README.md
once we have a complete list.)The text was updated successfully, but these errors were encountered: