Message291085
The documentation of typing.TYPE_CHECKING has an example (introduced in issue #26141) that would lead to NameError at runtime. The example shows how to limit the import of "expensive_mod" to type checkers, but then goes on to use "expensive_mod.some_type" in a type annotation that is evaluated at runtime ("local_var: expensive_mod.some_type"). The use case of TYPE_CHECKING is probably meant for type annotations placed in comments, e.g. "local_var # type: expensive_mod.some_type". |
|
Date |
User |
Action |
Args |
2017-04-03 17:32:43 | rav | set | recipients:
+ rav, docs@python |
2017-04-03 17:32:43 | rav | set | messageid: <1491240763.76.0.717121375128.issue29974@psf.upfronthosting.co.za> |
2017-04-03 17:32:43 | rav | link | issue29974 messages |
2017-04-03 17:32:43 | rav | create | |
|