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

Ben Finney ben+python at benfinney.id.au
Thu Apr 12 06:37:01 CEST 2012

Cameron Simpson <cs at zip.com.au> writes:

> "At the same time" might imply something equivalent to the cited
> "re.sub('foo|bar',...)" suggestion. And that is different to an iterated
> "replace foo, then replace bar" if the possible matched overlap.

Yes, it is; but the OP presented a proposal as though it were to have
the same semantics as a sequence of replace operations.

If the OP wants to specify different semantics, let's hear it.

 \         “A child of five could understand this. Fetch me a child of |
  `\                                              five.” —Groucho Marx |
_o__)                                                                  |
Ben Finney

More information about the Python-ideas mailing list