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 ethan.furman
Recipients barry, eli.bendersky, eric.smith, ethan.furman, serhiy.storchaka
Date 2013-08-15.21:29:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1376602174.71.0.191462324432.issue18738@psf.upfronthosting.co.za>
In-reply-to
Content
+    def __format__(self, *args, **kwargs):
+        return self.__class__._member_type_.__format__(self.value, *args, **kwargs)
+

With this in the Enum class all members simply forward formatting to the mixed-in type, meaning that IntEnum behaves exactly like int for formatting purposes.  Another way of saying that is that the name attribute of an IntEnum member will only be used when the !r or !s codes are used.

If we are all good with that, then the question remaining is how should pure enums handle formatting?  Should they also go the value route, or should they go with the name?
History
Date User Action Args
2013-08-15 21:29:34ethan.furmansetrecipients: + ethan.furman, barry, eric.smith, eli.bendersky, serhiy.storchaka
2013-08-15 21:29:34ethan.furmansetmessageid: <1376602174.71.0.191462324432.issue18738@psf.upfronthosting.co.za>
2013-08-15 21:29:34ethan.furmanlinkissue18738 messages
2013-08-15 21:29:34ethan.furmancreate