Skip to content

qiu_python_encore.enum

Better Enum for python.

Classes:

  • ExtendedEnum –

    Enum whose members also compare equal to their raw values.

ExtendedEnum

Bases: Enum

Enum whose members also compare equal to their raw values.

A member equals another member of the same enum by identity, a member of any other Enum with the same value, and its raw value itself, e.g. Color.RED == "red". Members hash like their values, so the hashing is consistent with this equality and members can be used in sets, as dict keys and with functools.cache.

Methods:

  • list –

    Return the raw values of the members, in definition order.

list classmethod

list() -> list[Any]

Return the raw values of the members, in definition order.

Source code in packages/qiu-python-encore/src/qiu_python_encore/enum.py
17
18
19
20
@classmethod
def list(cls) -> list[Any]:
    """Return the raw values of the members, in definition order."""
    return [member.value for member in cls]