[New-bugs-announce] [issue18995] Enum does not work with reversed
Vajrasky Kok
report at bugs.python.org
Tue Sep 10 11:14:23 CEST 2013
New submission from Vajrasky Kok:
cutecat at amiau:~/cpython$ cat /tmp/innerplanets.py
from enum import Enum
class innerplanets(Enum):
mercury = 1
venus = 2
earth = 3
mars = 4
for planet in innerplanets:
print(planet)
for planet in reversed(innerplanets):
print(planet)
cutecat at amiau:~/cpython$ ./python /tmp/innerplanets.py
innerplanets.mercury
innerplanets.venus
innerplanets.earth
innerplanets.mars
Traceback (most recent call last):
File "/tmp/innerplanets.py", line 11, in <module>
for planet in reversed(innerplanets):
File "/home/cutecat/cpython/Lib/enum.py", line 255, in __getitem__
return cls._member_map_[name]
KeyError: 3
Attached the patch to add support for reversed in enum.
----------
components: Library (Lib)
files: add_reversed_support_for_enum.patch
keywords: patch
messages: 197428
nosy: ethan.furman, vajrasky
priority: normal
severity: normal
status: open
title: Enum does not work with reversed
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file31711/add_reversed_support_for_enum.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18995>
_______________________________________
More information about the New-bugs-announce
mailing list