pytype icon indicating copy to clipboard operation
pytype copied to clipboard

Converting enum type into a list changes type to nothing

Open eltoder opened this issue 2 years ago • 0 comments

Consider the following example

from enum import Enum

class E(Enum):
    A = 1
    B = 2

for x in E:
    reveal_type(x)  # revealed as "E"
reveal_type(list(E))  # revealed as "List[nothing]"

Both with and without the --use-enum-overlay flag, pytype understands that iterating over an enum type returns elements of the enum. However, when converted into a list (I also tried tuple and iter), the element type turns into nothing.

eltoder avatar Feb 24 '23 01:02 eltoder