[issue33437] Defining __init__ in enums

Ethan Furman report at bugs.python.org
Tue May 8 11:01:04 EDT 2018


Ethan Furman <ethan at stoneleaf.us> added the comment:

That new example looks great!  Note that you don't need the parenthesis, though.

FYI: The same thing using the aenum library* would look like:

    from aenum import Enum

    class Coord(bytes, Enum):
    _init_ = 'value label unit'

    PX = [0], 'P.X', 'km'
    PY = [1], 'P.Y', 'km'
    VX = [2], 'V.X', 'km/s'
    VY = [3], 'V.Y', 'km/s'


* aenum is the Advanced Enum library I wrote that has a few extra abilities.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33437>
_______________________________________


More information about the Python-bugs-list mailing list