Skip to content

support enums #183

@carljm

Description

@carljm

Doc: https://docs.python.org/3/library/enum.html
Typing spec: https://typing.python.org/en/latest/spec/enums.html

Base features:

  • Differentiating members from non-members
  • Create a new type variant for enum literals
  • Enum literal expansion
  • Write a micro benchmark with large enums
  • Enforce implicit @final for Enum classes (with members)
  • Support iteration over enums
  • Detect enums in all cases (metaclass derives from EnumMeta/EnumType)

Advanced features:

  • Infer type for member names and member values.
  • Handling of enum.Flag (enum expansion may not be performed for subclasses of enum.Flag)
  • 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)
  • Custom __new__ or __init__ methods in enums.
  • auto() values
  • 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

Metadata

Metadata

Assignees

Labels

runtime semanticsAccurate modeling of how Python's semantics work at runtime

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions