[issue40595] AttributeError from type annotation
Ivan Levkivskyi
report at bugs.python.org
Fri May 15 16:48:00 EDT 2020
Ivan Levkivskyi <levkivskyi at gmail.com> added the comment:
Yes, this is as expected. A recommended workaround is to define a type alias like `Match = re.Match` before the class body. You can also suppress the exception with `from __future__ import annotations` (so that the annotations are not evaluated), but static type checkers like mypy will still force you to use the alias.
----------
nosy: +levkivskyi
resolution: -> not a bug
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40595>
_______________________________________
More information about the Python-bugs-list
mailing list