[issue18738] String formatting (% and str.format) issues with Enum

Eli Bendersky report at bugs.python.org
Wed Aug 14 21:00:32 CEST 2013


Eli Bendersky added the comment:

On Wed, Aug 14, 2013 at 11:56 AM, Eric V. Smith <report at bugs.python.org>wrote:

>
> Eric V. Smith added the comment:
>
> For format, I think the question is "should an IntEnum format like an int,
> with the wacky exception of a specifier of '', or should it always format
> like a str?"
>
> I assumed we'd want it to look like the str() version of itself, always.
> But it's debatable.
>
> I agree the %-formatting question is different, and I further think
> there's not much we can do there.
>

How about always being a string, unless integer formatting "%i" / {d} is
explicitly requested?

The alternative (always a string) is also fine, but the behavior should be
consistent. Certainly field-width-justification ({:}) can't affect the
formatting.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18738>
_______________________________________


More information about the Python-bugs-list mailing list