Implementation of autodoc-aware Enum for Python
Simple autodoc-aware C-like enumeration.
All enumeration names must be upper case and may not contain spaces, see below for examples.
>>> ReturnCodes = Enum('SUCCESS', ERROR='A non-fatal error occured',
FATAL='A fatal error occured')
>>> ReturnCodes.SUCCESS
0
Note
When using values with docstring the values are ordered alphabetically by their name. This is caused by how the dict type works.
Simple autodoc-aware C-like negative enumeration.
The difference to Enum is that values are assigned starting at -1 downwards.
>>> NegativeCodes = Enum('UI_ERROR', negative=True,
BACKEND_ERROR='Backend error')
>>> NegativeCodes.UI_ERROR
-1