I have a question about annotations for classes that derive from `Enum`. Instances of these classes are allowed to have custom instance variables that can be initialized by a custom `__init__` or `__new__` method. Refer to [this documentation](https://docs.python.org/3/library/enum.html#when-to-use-new-vs-init) for details. My question is, how would these instance variables be annotated in a type stub? How would a type checker differentiate between one of these instance variables and a class variable that represents a member of the enumeration (and therefore is typed as an instance of the enum class)? The metaclass apparently treats assignments within the class definition as enumeration values. Consider the following example: ```python class Color(Enum): # Members of the enumeration RED = ((1, 0, 0), "#FF0000") YELLOW = ((0, 1, 1), "#00FFFF") GREEN = ((0, 1, 0), "#00FF00") # Instance variables for instances of this enumeration components: Tuple[float, float, float] html_encoding: str # Custom init method def __init__(self, components: Tuple[float, float, float], html_encoding: str) -> None: self._value_ = html_value self.components = components self.html_encoding = html_encoding print(Color.RED.value) # "#FF0000" print(Color.RED.components) # (1, 0, 0) ``` How would I annotate this in a type stub? I would have thought the following: ```python class Color(Enum): RED = ... YELLOW = ... GREEN = ... components: Tuple[float, float, float] html_encoding: str ``` However, mypy interprets all five of the variables (including `components` and `html_encoding`) as members of the enumeration. ```python reveal_type(Color.RED) # Revealed type is 'Literal[test.Color.RED]?' reveal_type(Color.components) # Revealed type is 'Literal[test.Color.components]?' reveal_type(Color.html_encoding) # Revealed type is 'Literal[test.Color.html_encoding]?' ``` Furthermore, if I look at the way that enums are annotated in typeshed, they don't appear to use assignments to indicate enum elements. For example, `uuid.pyi` includes the following declaration. ```python class SafeUUID(Enum): safe: int unsafe: int unknown: None ``` So typeshed stubs appear to assume that variables with type annotations within a `Enum` class definition should be interpreted as members of the enumeration, not as instance variables within enum instances. I searched the typeshed and mypy issues and couldn't find any discussion of this topic. Any thoughts or suggestions? -- Eric Traut Contributor to Pyright & Pylance Microsoft Corp.