Open d05aef1e-abc2-4a6e-b042-f2fd671dd9f2 opened 3 years ago
Chained str.replace calls can sometimes be pretty unattractive; what are the chances that we could have an str.replaceall method? Of type Callable[[Mapping[str, str]], str]?
Check out absl::StrReplaceAll (https://github.com/abseil/abseil-cpp/blob/22771d471930ce88e1e75d0ca9dd8c65a7b0f895/absl/strings/str_replace.h#L73-L98) for a similarly useful function in C++.
Hi, the bug tracker is not the right place to propose to add a new method to the builtin str type. I suggest to propose it on the python-ideas list. I'm quite sure that it was proposed at least once, so please search in the archives.
Versions 3.6-3.9 are all in feature-freeze, so the earliest this could be added is version 3.10.
Marking as "pending" while a discussion takes place on python-ideas.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields: ```python assignee = None closed_at = None created_at =
labels = ['type-feature', '3.10', 'expert-unicode']
title = 'Add str.replaceall?'
updated_at =
user = 'https://github.com/nathanielmanistaatgoogle'
```
bugs.python.org fields:
```python
activity =
actor = 'rhettinger'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Unicode']
creation =
creator = 'Nathaniel Manista'
dependencies = []
files = []
hgrepos = []
issue_num = 43015
keywords = []
message_count = 5.0
messages = ['385581', '385616', '385617', '385687', '385842']
nosy_count = 5.0
nosy_names = ['rhettinger', 'vstinner', 'ezio.melotti', 'steven.daprano', 'Nathaniel Manista']
pr_nums = []
priority = 'normal'
resolution = 'later'
stage = None
status = 'pending'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue43015'
versions = ['Python 3.10']
```