[Python-Dev] format, int, and IntEnum

Ethan Furman ethan at stoneleaf.us
Thu Aug 15 19:55:45 CEST 2013


On 08/15/2013 10:44 AM, Eric V. Smith wrote:
> On 08/15/2013 11:21 AM, Ethan Furman wrote:
>> Given that the !r and !s format codes can be used to get the repr and
>> str of an IntEnum, would it be acceptable to have IntEnum's __format__
>> simply pass through to int's __format__?  And likewise with all mix-in
>> classes?
>
> That helps with str.format(), but not with built-in format(). There,
> you'd have to explicitly call str() or repr():

Given that !s and !r are explicitly asking for str or repr, I'm okay with that.

--
~Ethan~


More information about the Python-Dev mailing list