[Python-ideas] in str.replace(old, new), allow 'old' to accept a tuple
Gregory P. Smith
greg at krypto.org
Fri Apr 13 02:40:01 CEST 2012
On Wed, Apr 11, 2012 at 9:56 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On Thu, Apr 12, 2012 at 2:37 PM, Ben Finney <ben+python at benfinney.id.au>
> > If the OP wants to specify different semantics, let's hear it.
> Whatever semantics were chosen, they would end up being confusing to
> With prefix and suffix matching, the implicit OR is simple and
> obvious. The same can't be said for the replacement command,
> particular if it can be used with unordered collections.
> Far better to leave this task to re.sub (which uses regex syntax to
> avoid ambiguity) or to explicit flow control and multiple invocations
> of replace().
Agreed. Which is why I'm -1 on the proposed change to str.replace().
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas