[issue18995] Enum does not work with reversed

2013-09-14 Thread Ethan Furman
Ethan Furman added the comment: Well, I totally messed up the commit message, but the code is now in place. Thanks, Vajrasky Kok! -- resolution: -> fixed stage: patch review -> committed/rejected status: open -> closed ___ Python tracker

[issue18995] Enum does not work with reversed

2013-09-11 Thread Ethan Furman
Ethan Furman added the comment: Yes, I was aware of that method (not that we would add it that way). __reversed__ is definitely better for Enum. -- ___ Python tracker ___ _

[issue18995] Enum does not work with reversed

2013-09-11 Thread Vajrasky Kok
Vajrasky Kok added the comment: Simplified unit test. I reused enum Season in the test class. By the way, there is another way to add support for enum without implementing __reversed__ method, which is adding support indexing by number (in __getitem__ method), e.g. Season[1] => Season.SPRING.

[issue18995] Enum does not work with reversed

2013-09-11 Thread Ethan Furman
Ethan Furman added the comment: Cool, I didn't even know __reversed__ existed! -- assignee: -> ethan.furman stage: -> patch review ___ Python tracker ___ __

[issue18995] Enum does not work with reversed

2013-09-10 Thread Vajrasky Kok
New submission from Vajrasky Kok: 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) cut