
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2016-12-14 21:52 byserhiy.storchaka, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| simpler-object-__format__.patch | serhiy.storchaka,2016-12-14 21:52 | review | ||
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 506 | merged | serhiy.storchaka,2017-03-06 09:53 | |
| Messages (4) | |||
|---|---|---|---|
| msg283220 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2016-12-14 21:52 | |
OriginallyPEP 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 inissue28385 and the discussion on Python-Dev:https://mail.python.org/pipermail/python-dev/2016-October/146765.html. | |||
| msg293605 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2017-05-13 08:36 | |
What are your thoughts about this Eric? | |||
| msg293607 -(view) | Author: Eric V. Smith (eric.smith)*![]() | Date: 2017-05-13 09:08 | |
I'm okay with this change. | |||
| msg293609 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2017-05-13 09:40 | |
New changeset7e19dbc92ec06a987eaae72f7cdfd32006aa4960 by Serhiy Storchaka in branch 'master':bpo-28974: `object.__format__(x, '')` is now equivalent to `str(x)` (#506)https://github.com/python/cpython/commit/7e19dbc92ec06a987eaae72f7cdfd32006aa4960 | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:40 | admin | set | github: 73160 |
| 2017-05-13 09:41:23 | serhiy.storchaka | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2017-05-13 09:40:54 | serhiy.storchaka | set | messages: +msg293609 |
| 2017-05-13 09:08:03 | eric.smith | set | messages: +msg293607 |
| 2017-05-13 08:36:34 | serhiy.storchaka | set | messages: +msg293605 |
| 2017-03-06 09:57:34 | rhettinger | set | nosy: +rhettinger |
| 2017-03-06 09:53:17 | serhiy.storchaka | set | pull_requests: +pull_request415 |
| 2016-12-14 21:52:10 | serhiy.storchaka | create | |