Open
Description
I'm submitting a request for TC review and approval of an addition to the typing spec that clarifies the intended behavior of imports that target Final
variables.
- PR: Added "Importing Final Variables" section typing#1937
- Discussion: [Specs clarification:
type[A | B]
is equivalent/the same astype[A] | type[B]
](https://discuss.python.org/t/imported-final-variable/82429)
As noted in the Python Forum discussion, pyright and mypy already implement the specified behavior. I have not yet checked pytype or pyre.
In the discussion, a few participants indicated that they wouldn't expect Final
to propagate on import, but the majority consensus appears to be in favor. Jukka also pointed out that mypy was the reference implementation for PEP 591, and although this behavior wasn't spelled out in PEP 591, it was the intended behavior.
TC Sign-off
- Carl
- Eric
- Jelle
- Jukka
- Rebecca
Metadata
Metadata
Assignees
Labels
No labels
Activity