[issue40148] Add PurePath.with_stem()

Qi Yao report at bugs.python.org
Sat Dec 26 20:42:41 EST 2020


Qi Yao <tinyaoqi at gmail.com> added the comment:

In Pathlib, we have functions "with_name()""with_stem()""with_suffix()" to modify the file name in the path.

In issue21798:"Allow adding Path or str to Path", it actually also want to modify the file name, that is "appand string to file name".

if with_stem() more cumbersome as:
path.with_name(path.stem + '_v2' + path.suffix)

why not have a function with_xxxx() more cumbersome as:
path.with_name(path.name + "_name.dat")

----------
nosy: +tinyaoqi

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


More information about the Python-bugs-list mailing list