You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because we know that Enum classes cannot be further subclassed, picking apart a value that could be a specific enum or some other type by comparing to all possible values of the enum should be enough to conclude that in the "else" clause the value cannot be an instance of that enum any more, so it must be the other type (examples in the linked PEP section).
This should work for other singletons, specifically Ellipsis. (Though it's unclear how its type should be spelled since builtins.ellipsis only exists in the stubs, not in the actual runtime.)
Activity
gvanrossum commentedon Sep 25, 2016
This should work for other singletons, specifically Ellipsis. (Though it's unclear how its type should be spelled since builtins.ellipsis only exists in the stubs, not in the actual runtime.)
ilevkivskyi commentedon May 17, 2018
It looks like this would be easier to implement after we support literal types.
Generalize reachability checks to support enums (#7000)