Eric V. Smith added the comment: I think IntEnum should act like a str for format() purposes. After all, having a useful string representation is a prime reason it exists. If you want it to act like a str() sometimes, and an int() at others, you're going to have to parse the format specifier and figure out what to do. It might be as easy as:
def __format__(self, fmt): if len(fmt) >= 1 and fmt[-1] in 'oOxXdD': # treat like an int return format(self.value, fmt) else: # treat like a string format(str(self), fmt) But I haven't completely thought it through or tested it. Or, couldn't we just say it's always str, and if you want to treat it like an int then use .value? ---------- _______________________________________ 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