Open phidra opened 3 years ago
As a side note, even if the enum has an __init__
, it is still impossible to add a new Planet
:
a_brand_new_planet = Planet(5.5, 6.6)
# TypeError: Cannot extend enumerations
Similar to https://github.com/python/mypy/issues/10573
Bug Report
mypy behaves weirdly when narrowing type on an enum that has an
__init__
(as described in the enum doc), whereas it succeeds with "regular" enums.To Reproduce
__init__
(this is the example of the enum doc) :Expected Behavior
I'd have expected the same behaviour as with a "regular" enum :
Actual Behavior
Revealed type after the narrowing weirdly includes the attributes.
Note : as the problem seems to be related to how
self
is handled, maybe it is related to this issue, even if the situation is quite different ?Your Environment
0.800
mypy.ini
: None3.8.10
Ubuntu 20.04.2 LTS