[issue38222] pathlib Path objects should support __format__
Eric V. Smith
report at bugs.python.org
Mon Sep 13 12:47:19 EDT 2021
Eric V. Smith <eric at trueblade.com> added the comment:
> log_dir = Path('logs/{date}')
> log_file = Path(str(path).format(time.strftime('%Y-%m-%d')) / 'log.txt'
(I think you're missing "date=" in the call to .format().)
Could you show what you think this would look like if Path.__format__ existed? I don't think anyone's suggesting that path.format() would be added by this issue, but maybe that would be a reasonable proposal as a different issue.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38222>
_______________________________________
More information about the Python-bugs-list
mailing list