[issue38222] pathlib Path objects should support __format__

Serhiy Storchaka report at bugs.python.org
Thu Sep 19 05:02:13 EDT 2019


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

Initially, the default __format__ converted the object to str and passed format specifier to str.__format__. This is defined in PEP 3101:

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

But later we changed the implementation, because this leaded to difficult to catch errors. Non-empty format specifier is now error in the default __format__.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38222>
_______________________________________


More information about the Python-bugs-list mailing list