[issue38222] pathlib Path objects should support __format__
Eric V. Smith
report at bugs.python.org
Thu Sep 19 06:04:27 EDT 2019
Eric V. Smith <eric at trueblade.com> added the comment:
Correct: this change was made specifically so that objects could add their own format specifiers at a later time. If I recall correctly, This change was precipitated by wanting to add datetime.__format__: this change broke existing uses for format() that formatted datetimes as strings.
But the result is that objects that really just want to be formatted as strings need to have their own __format__ which returns format(str(self), format_spec).
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38222>
_______________________________________
More information about the Python-bugs-list
mailing list