Mailing List Archive

[issue43015] Add str.replaceall?
New submission from Nathaniel Manista <nathaniel@google.com>:

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++.

----------
components: Unicode
messages: 385581
nosy: Nathaniel Manista, ezio.melotti, vstinner
priority: normal
severity: normal
status: open
title: Add str.replaceall?
type: enhancement
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue43015>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue43015] Add str.replaceall? [ In reply to ]
STINNER Victor <vstinner@python.org> added the comment:

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.

----------

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue43015>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue43015] Add str.replaceall? [ In reply to ]
STINNER Victor <vstinner@python.org> added the comment:

https://mail.python.org/mailman3/lists/python-ideas.python.org/

----------

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue43015>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue43015] Add str.replaceall? [ In reply to ]
Steven D'Aprano <steve+python@pearwood.info> added the comment:

Versions 3.6-3.9 are all in feature-freeze, so the earliest this could be added is version 3.10.

----------
nosy: +steven.daprano
versions: -Python 3.6, Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue43015>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com