[issue38222] pathlib Path objects should support __format__
Eric V. Smith
report at bugs.python.org
Thu Sep 19 04:16:20 EDT 2019
Eric V. Smith <eric at trueblade.com> added the comment:
I agree with Serhiy that !s solves the problem. But as a convenience it might be nice to add __format__. This issue pops up from time to time on Path and other types, and I don't think !s is very discoverable. Especially because formatting works with a specifier, but fails with one:
>>> format(path)
'/path/to/enlightenment'
>>> format(path, '>50')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported format string passed to PosixPath.__format__
----------
nosy: +eric.smith
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38222>
_______________________________________
More information about the Python-bugs-list
mailing list