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
error: Incompatible types in assignment (expression has type "TextIO", variable has type "TextIOBase")
error: Argument 1 to "write" of "TextIOBase" has incompatible type "bytes"; expected "str"
This is okay, but a poor error message, e.g. "Did you mean typing.TextIO?" might be a better error message. A stretch goal :)
io.TextIOWrapper
from io import TextIOWrapper as TIO
Fails at type check:
error: Incompatible types in assignment (expression has type "TextIO", variable has type "TextIOWrapper")
Also okay.
typing.TextIO
from typing import TextIO as TIO
Works great, but type(sys.stdin) is not TextIO in Python 3.6.
Dropped my notes / examples / Dockerfile into https://gist.github.com/zeckalpha/c0bed39b7de8dee64e0c895b852a850d
I've been having trouble adding types to:
Depending on which class is used for the typing we get different results:
io.TextIO
Type checks but fails at runtime with:
I'd expect this one to fail during type checking. This is a bug, I think. There seems to be issues with https://github.com/python/typeshed/blob/397f99836842494de2e9561001d16cbe64b3b937/stdlib/3/io.pyi and I suspect a change there (possibly breaking it out to minor versions of Python 3) would catch this.
io.TextIOBase
Fails at type check:
This is okay, but a poor error message, e.g. "Did you mean typing.TextIO?" might be a better error message. A stretch goal :)
io.TextIOWrapper
from io import TextIOWrapper as TIO
Fails at type check:
Also okay.
typing.TextIO
Works great, but type(sys.stdin) is not TextIO in Python 3.6.
Related issues with
TextIO
:#2111
#2337
#266
https://github.com/python/mypy/issues/1462
python/typeshed#163
The text was updated successfully, but these errors were encountered: