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 Gawain Bolton, eric.smith, zach.ware
Date 2019-05-03.22:00:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1556920815.34.0.124310028015.issue36787@roundup.psfhosted.org>
In-reply-to
Content
This behavior isn't going to change. As Zach says, if you want to convert any value to a string, use !s. We want to fail as soon as possible: if a class (such as NoneType) doesn't implement __format__, then trying to format an instance with a format spec that doesn't apply to it should be an error. If you want to support strings or None, then it's your job to ensure the conversion.

As issue7994 says, one of the big drivers of this change (I'll argue it's really a bugfix) was that you could never add __format__ to  class if it didn't previously have one. Or if you did, it would have to support at least the string format spec, since there might be code that formatted it with "^10", for example.

As things currently stand, we could add __format__ to NoneType and have "T/F" mean convert to "True" or "False". If NoneTypes were already format-able with "^10", this change wouldn't be possible.
History
Date User Action Args
2019-05-03 22:00:15eric.smithsetrecipients: + eric.smith, zach.ware, Gawain Bolton
2019-05-03 22:00:15eric.smithsetmessageid: <1556920815.34.0.124310028015.issue36787@roundup.psfhosted.org>
2019-05-03 22:00:15eric.smithlinkissue36787 messages
2019-05-03 22:00:15eric.smithcreate