A enum library for Python.
- enum
A simple enum implementation that maps a "variable" to a constant.
- RichEnum
An enum implementation that offers more functionality than a basic enum, hence the name: RichEnum. Provided functionality include specifying a canonical name and a display name. The canonical name should be used if you need to do a lookup or reference in your code. The display name should be used if you need to display text to a user.
- OrderedRichEnum
Exactly like RichEnum but also has an index specified for each enum value. Also, iteration over an OrderedRichEnum will be sorted (ascending) by the enum value's index.
$ pip install richenum
Example Usage |
---|
---- |
enum |
---- |
|
|
|
|
|
|
-------- |
RichEnum |
-------- |
|
|
|
|
|
|
|
|
|
--------------- |
OrderedRichEnum |
--------------- |
|
|
|
|
|
|
|
|
|
|
|
================ |
Related Packages |
- django-richenum
Makes RichEnum and OrderedRichEnum available in as model fields and form fields in Django.
- enum
Starting with Python 3.4, there is a standard library for enumerations. This class has a similar API, but is not directly compatible with that class.
- Fork the repo from GitHub.
- Make your changes.
- Add unittests for your changes.
- Run pep8, pyflakes, and pylint to make sure your changes follow the Python style guide and doesn't have any errors.
- Add yourself to the AUTHORS file (in alphabetical order).
- Send a pull request from your fork to the main repo.