Like repr and string the file system path is used alot and something like
path!p might be handy.

>>> class MyClass:
...     def __fspath__(self):
...         return "/home/batuhan"
...
>>> assert f"{mc!p}" == f"{os.fspath(mc)}"

Also it saves us to unnecessarily import os for only fspath().
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to