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 serhiy.storchaka
Recipients eric.smith, serhiy.storchaka
Date 2016-12-14.21:52:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Originally PEP 3101 defined the default __format__ implementation, object.__format__ as

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

After few changes (issue7994, issue28385) it now looks as

     def __format__(self, format_spec):
         assert format_spec == ''
         return format(str(self), '')

Proposed patch makes it yet simpler:

     def __format__(self, format_spec):
         assert format_spec == ''
         return str(self)

This is equivalent to the previous form except obscure case when str() returns not exact str, but strict subclass with overridden __format__.

The benefit of this change is simpler semantical model of the default implementation.

See the start of the discussion in issue28385 and the discussion on Python-Dev:
Date User Action Args
2016-12-14 21:52:10serhiy.storchakasetrecipients: + serhiy.storchaka, eric.smith
2016-12-14 21:52:10serhiy.storchakasetmessageid: <>
2016-12-14 21:52:10serhiy.storchakalinkissue28974 messages
2016-12-14 21:52:10serhiy.storchakacreate