Ethan Furman added the comment: > Eric V. Smith added the comment: > > I assumed we'd want it to look like the str() version of itself, always. But > it's debatable.
An IntEnum's str and repr should be (and any format or % codes that are the equivalent) the Enum str and repr. The % and format codes that specifically call for a numeric representation should give that numeric representation (format is good here, % is not). > 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 think for format we should treat IntEnums as ints unless the s or r codes are specifically used. > I agree the %-formatting question is different, and I further think there's > not much we can do there. We can have unicodeobject.c convert int (and float) subclasses to actual ints and floats before getting the numeric value (we just did this to _json.c so it could serialize IntEnums). ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18738> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com