Members of Enum class appear as specific types, not members of an enumeration
I am implementing the Enum class, but it keeps showing up as regular class variables. For example:
from enum import Enum
class test(Enum):
one = 1
two = 2
thr = "three"
using this i get:
>>> print type(test.one)
<type 'int'>
>>> print repr(test.one)
1
>>> print test.one
1
>>> print type(test.thr)
<type 'str'>
>>> print repr(test.thr)
'three'
>>> print test.thr
three
What could be wrong?
information:
$ python --version
Python 2.7.3
$ python -c "import enum; print enum.__version__"
0.4.4
+3
DilithiumMatrix
source
to share
1 answer
The enumeration introduced in python 3.4 is under enum34 . You seem to have the misfortune to install this enum package which is completely different.
+2
kalhartt
source
to share