This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eric.smith
Recipients Jason Spencer, eric.smith, martin.panter
Date 2018-08-22.14:28:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
About translating ":s" to "":

> The library seems
willing to do this for the empty format string, but not when the client
code specifically asks for a string....

You're not asking for a string when you specify ":s". You're asking the object to interpret "s" however it wants. For example, if the object is a datetime, you're asking for the output to be "s":

>>> f'{}'


>>> f'{}'
'2018-08-22 10:27:25.188891'

It's precisely because we want to let the object interpret the string that Python no longer guesses as to what you might mean.

For example, say you have a MyDate object, that doesn't support __format__, and you want Python to decide that format(MyDate(), 's') means is the same as format(MyDate(), ''). But later you decide that you want the format strings to call strftime (like datetime does). You couldn't do that without breaking existing usage of your library.

This actually happened with complex when I added complex.__format__.
Date User Action Args
2018-08-22 14:28:21eric.smithsetrecipients: + eric.smith, martin.panter, Jason Spencer
2018-08-22 14:28:21eric.smithsetmessageid: <>
2018-08-22 14:28:21eric.smithlinkissue34425 messages
2018-08-22 14:28:21eric.smithcreate