Message195293
The whole point of IntEnum and replacing stdlib constants with it was friendly str & repr out of the box. This means that "just printing out" an enum member should have a nice string representation. And "just printing out" means:
print(member)
"%s" % member
"{}".format(member)
!s/!r are quite esoteric - IntEnum should behave in the nicest way possible out of the box.
Let's just rig IntEnum's __format__ to do the right thing and not worry about Enum itself. I hope that mixin-with-Enum cases are rare (and most are IntEnum anyway), and in such rare cases users are free to lift the implementation from IntEnum. |
|
Date |
User |
Action |
Args |
2013-08-15 21:46:50 | eli.bendersky | set | recipients:
+ eli.bendersky, barry, eric.smith, ethan.furman, serhiy.storchaka |
2013-08-15 21:46:50 | eli.bendersky | set | messageid: <1376603210.07.0.54860483499.issue18738@psf.upfronthosting.co.za> |
2013-08-15 21:46:50 | eli.bendersky | link | issue18738 messages |
2013-08-15 21:46:49 | eli.bendersky | create | |
|