You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In https://github.com/python/cpython/blob/master/Lib/typing.py#L115-L117, there is a note about the io and re classes not being included in typing.all. I am a relatively new user of typing, and I did from typing import * in my code. I ran the code through mypy first, which reported no problems, but then running Python 3.6 failed with a NameError (name 'IO' is not defined).
Reading through the typing source, it's clear that this was an intentional decision. So, instead of reporting a bug, I'd like to request a documentation enhancement!
The docs for typing make no mention of typing.io or typing.re. So, my request is: In the sections for the IO/TextIO/BinaryIO and Pattern/Match classes, include text warning the user that these types are not imported when you do from typing import *.
would indeed be bad, but that argument IMHO doesn't hold for the types IO, TextIO and BinaryIO, yet they are not listed in typing.__all__. Is there a reason for that? And if not, could IO, TextIO and BinaryIO be added to typing.__all__?
I'm actually not sure this should go into 3.9. Seems potentially dangerous that people upgrading from an earlier 3.9 patch release will now see new names injected into their namespace if they do from typing import *.