You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make default __format__ be equivalent to __str__ #73160
Activity
serhiy-storchaka commentedon Dec 14, 2016
Originally PEP-3101 defined the default __format__ implementation, object.__format__ as
After few changes (bpo-7994, bpo-28385) it now looks as
Proposed patch makes it yet simpler:
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 bpo-28385 and the discussion on Python-Dev: https://mail.python.org/pipermail/python-dev/2016-October/146765.html.
serhiy-storchaka commentedon May 13, 2017
What are your thoughts about this Eric?
ericvsmith commentedon May 13, 2017
I'm okay with this change.
serhiy-storchaka commentedon May 13, 2017
New changeset 7e19dbc by Serhiy Storchaka in branch 'master':
bpo-28974:
object.__format__(x, '')is now equivalent tostr(x)(#506)7e19dbc