This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vajrasky
Recipients ethan.furman, vajrasky
Date 2013-09-10.09:14:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1378804463.14.0.741296151335.issue18995@psf.upfronthosting.co.za>
In-reply-to
Content
cutecat@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@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.
History
Date User Action Args
2013-09-10 09:14:23vajraskysetrecipients: + vajrasky, ethan.furman
2013-09-10 09:14:23vajraskysetmessageid: <1378804463.14.0.741296151335.issue18995@psf.upfronthosting.co.za>
2013-09-10 09:14:23vajraskylinkissue18995 messages
2013-09-10 09:14:22vajraskycreate