[issue40148] Add PurePath.with_stem()

Tim Hoffmann report at bugs.python.org
Wed Apr 1 20:40:24 EDT 2020


New submission from Tim Hoffmann <tim.hoffmann at posteo.de>:

Similar to PurePath.with_name() and PurePath.with_suffix() there should be a PurePath.with_stem().

A common use case would be appending something before the suffix: path.with_stem(path.stem + '_v2')

As of now this must be written more cumbersome as:
path.with_name(path.stem + '_v2' + path.suffix)

----------
components: Library (Lib)
messages: 365540
nosy: timhoffm
priority: normal
severity: normal
status: open
title: Add PurePath.with_stem()

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


More information about the Python-bugs-list mailing list