[issue38352] In typing docs, note explicit import needed for IO and Pattern/Match
Karl Kornel
report at bugs.python.org
Wed Oct 2 14:31:17 EDT 2019
New submission from Karl Kornel <karl at kornel.us>:
Hello!
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 *`.
----------
assignee: docs at python
components: Documentation
messages: 353763
nosy: Karl Kornel, docs at python
priority: normal
severity: normal
status: open
title: In typing docs, note explicit import needed for IO and Pattern/Match
type: behavior
versions: Python 3.6
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38352>
_______________________________________
More information about the Python-bugs-list
mailing list