[Python-Dev] Re: string.find() again (was Re: timsort for jython)

Guido van Rossum guido@python.org
Fri, 09 Aug 2002 10:13:12 -0400


> Since '' in 'abc' now returns True, How about changing
> 'abc'.replace('') to generate '_a_b_c_', too? It is consistent with
> re.sub()/subn() and the cost for change is similar to '' in 'abc'
> case.

Do you have a use case?  Or are you just striving for consistency?  It
would be more consistent but I'm not sure what the point is.  I can
think of situations where '' in 'abc' would be needed, but not so for
'abc'.replace('', '_').

--Guido van Rossum (home page: http://www.python.org/~guido/)