Skip to content

Alias to enum member is treated as separate member #7142

@erictraut

Description

@erictraut

This comes from a recently-filed mypy issue: python/mypy#16830.

from enum import Enum

class TrafficLight(Enum):
    RED = 1
    GREEN = 2
    YELLOW = 3

    AMBER = YELLOW  # Alias for YELLOW

reveal_type(TrafficLight.AMBER)  # Should be Literal[TrafficLight.YELLOW]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions