An alternative to the built-in Python 6 implementation. Tested in Python 3.6 and above.Data enums allow you to:
UsageInstall via PyPI:
Minimal usage:
Access the members by value:
Store the members as attributes:
Use a custom attribute as the primary ID:
Use integers as primary IDs:
Or, skip primary IDs altogether for a pure enumeration:
Access the attached data:
Compare directly:
Enforce unique secondary attributes:
Look up members by unique secondary attributes: 0Look up with members with defaults: 1Testing, etc.Install requrements: 2Sort imports (Requires Python >= 3.6): 3Lint (Requires Python >= 3.6): 4Test: 5 |