[Python-ideas] in str.replace(old, new), allow 'old' to accept a tuple

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Apr 13 01:01:46 CEST 2012

Stefan Behnel wrote:
> And str.replace() isn't the
> right interface for anything but a one-shot operation if the intention is
> to pass in a sequence of keywords.

So maybe a better approach would be to enhance maketrans so
that both keys and replacements can be more than one character

Behind the scenes, it could build a DFA or whatever is needed
to do it efficiently.


More information about the Python-ideas mailing list