Issue40148
Created on 2020-04-02 00:40 by timhoffm, last changed 2022-04-11 14:59 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 19295 | merged | timhoffm, 2020-04-02 01:31 | |
| Messages (4) | |||
|---|---|---|---|
| msg365540 - (view) | Author: Tim Hoffmann (timhoffm) * | Date: 2020-04-02 00:40 | |
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) |
|||
| msg365608 - (view) | Author: Brett Cannon (brett.cannon) * | Date: 2020-04-02 17:46 | |
I personally would rather not add more methods that are doing simple string manipulations. |
|||
| msg366785 - (view) | Author: Antoine Pitrou (pitrou) * | Date: 2020-04-19 15:29 | |
New changeset 8aea4b3605059e243f1827d9328d6fc8d698c0a7 by Tim Hoffmann in branch 'master': bpo-40148: Add PurePath.with_stem() (GH-19295) https://github.com/python/cpython/commit/8aea4b3605059e243f1827d9328d6fc8d698c0a7 |
|||
| msg383834 - (view) | Author: Qi Yao (tinyaoqi) | Date: 2020-12-27 01:42 | |
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") |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:28 | admin | set | github: 84329 |
| 2020-12-27 01:42:41 | tinyaoqi | set | nosy:
+ tinyaoqi messages: + msg383834 |
| 2020-04-19 15:30:07 | pitrou | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2020-04-19 15:29:56 | pitrou | set | messages: + msg366785 |
| 2020-04-02 17:46:11 | brett.cannon | set | nosy:
+ brett.cannon messages: + msg365608 |
| 2020-04-02 05:44:21 | SilentGhost | set | nosy:
+ pitrou type: enhancement |
| 2020-04-02 01:31:56 | timhoffm | set | keywords:
+ patch stage: patch review pull_requests: + pull_request18654 |
| 2020-04-02 00:40:24 | timhoffm | create | |