[Python-Dev] format, int, and IntEnum (original) (raw)
Eric V. Smith eric at trueblade.com
Thu Aug 15 19:44:15 CEST 2013
- Previous message: [Python-Dev] format, int, and IntEnum
- Next message: [Python-Dev] format, int, and IntEnum
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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():
'{:10}'.format(True) ' 1' format(True, '10') ' 1'
'{!s:10}'.format(True) 'True ' format(str(True), '10') 'True '
Eric.
- Previous message: [Python-Dev] format, int, and IntEnum
- Next message: [Python-Dev] format, int, and IntEnum
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]