-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Name 'typing.io.IO' is not defined #4639
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
Right, it's meant as a namespace, it seems mypy doesn't understand this |
We added this to PEP 484 and typing.py in a relatively late stage, as a preferred way to separate support for specific modules from support for fundamentals (including containers). I guess mypy never implemented it. Maybe you can also submit a doc bug for Python 3.5? |
It's a passive-aggressive way of telling people that using Seriously, we should add it, but I'd also like to deprecate it, at least in the docs. |
How do we go around adding type aliases inside the class io:
__all__ = ['IO', 'TextIO', 'BinaryIO']
IO = Union[IO]
TextIO = Union[TextIO]
BinaryIO = Union[BinaryIO] but this introduces cyclic definition error in mypy Also, the Union is used as workaround for this |
We should probably just give up on |
Okay, let's close this then. Can someone file an issue with cpython to deprecate typing.io? |
Created the issue to deprecate: https://bugs.python.org/issue42001 |
The Python 3.5 docs list a
typing.io
something ("wrapper namespace" according to docs, class according to interpreter), which you can access withIO
to get an IO type, or for exampleTextIO
. Using this in an interpreter works fine, but mypy complains about this.I understand (now) that
typing.IO
is also possible, but the docs are very vague about that being a possibility, which is why I didn't even try it. Docs aside, since this works in the interpreter I think it should also work in mypy, which is why I'm reporting it.The text was updated successfully, but these errors were encountered: