Skip to content

Enums: advanced features #876

@sharkdp

Description

@sharkdp

We have basic support for enums, but there is a long tail of things that could be improved:

  • Infer type for member names and member values.
  • Special-case handling of IntEnum, StrEnum, or other custom classes that derive from both Enum and some other class (infer appropriate types for member values)
  • auto() values
  • Handling of enum.Flag (enum expansion may not be performed for subclasses of enum.Flag)
  • Custom __new__ or __init__ methods in enums.
  • Support for _generate_next_value_
  • Special-case handling for call to enum class to retrieve member by value (e.g. Color("red"))
  • Function syntax to create Enums

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    enumstyping semanticstyping-module features, spec compliance, etc

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions