Eric V. Smith added the comment:

I think:

>>> '{:}'.format(AF.IPv4)
'AF.IPv4'

is correct, assuming str(AF.IPv4) is 'AF.IPv4'. I'm not sure what:

>>> '{:10}'.format(AF.IPv4)

should produce. There's a special case for an empty format string calling str().

I think that specifying __format__() would be best, except then you need to 
decide what sort of format specification language you want to support, and deal 
with all of the implementation details. Or, maybe just have Enum's __format__ 
be:

    def __format__(self, fmt):
        return format(str(self), fmt)

which makes the format specification language match str's.

%-formatting is a whole different thing, of course.

----------
assignee: ethan.furman -> 

_______________________________________
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

Reply via email to