11 Apr
2012
11 Apr
'12
6:59 p.m.
On Apr 11, 2012, at 3:47 PM, Ben Finney wrote:
'foo bar baz'.replace(('foo', 'bar'), 'foobar')
You can't replace multiple matches “at the same time”, as you're implying. The order of replacements is important, since it will affect the outcome in many cases.
Can't you say the same about 'a b c'.replace("a", "aa")? I think the case of the needles overlapping is more to your point though. "abc".replace( ("ab", "bc"), "b") What should that produce? "bc"? "b"? "ab" even (if we ignore the order of the tuple)?