A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-May/065155.html below:

[Python-Dev] replace on empty strings

[Python-Dev] replace on empty strings [Python-Dev] replace on empty stringsGuido van Rossum guido at python.org
Wed May 24 19:45:14 CEST 2006
On 5/24/06, Fredrik Lundh <fredrik at pythonware.com> wrote:
> so, which one is correct ?
>
> Python 2.4.3
>  >>> "".replace("", "a")
> ''
>  >>> u"".replace(u"", u"a")
> u'a'

Since 'x'.replace('', 'a') and u'x'.replace('', u'a') return 'axa' and
u'axa', respectively, I conclude that the unicode version is correct
and the 8-bit string version is an anomaly.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4