Skip to content

Support StrEnum #3945

@PaleNeutron

Description

@PaleNeutron

Feature Request Type

  • Core functionality
  • Alteration (enhancement/optimization) of existing feature(s)
  • New behavior

Description

Since python 3.11 , enum module provide StrEnum which use value instead of key:


class Direction(StrEnum):
    NORTH = 'north'
    SOUTH = 'south'

print(Direction.NORTH)
>>> north

And is supported by pydantic.

This allow user use value not suitable for variable name as enum, for example, "01ab".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions