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/2001-May/014668.html below:

[Python-Dev] Inconsistent string.replace() behavior

[Python-Dev] Inconsistent string.replace() behaviorTim Peters tim.one@home.com
Wed, 9 May 2001 20:47:52 -0400
test_strop.py contains this line:

    test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 0)

string_tests.py has this:

    test('replace', 'one!two!three!', 'one!two!three!', '!', '@', 0)

IOW, the test suite insists that

    strop.replace('one!two!three!', '!', '@', 0)

replace all matches but that

    string.replace('one!two!three!', '!', '@', 0)
and
    'one!two!three!'.replace('!', '@', 0)

replace nothing.

I've been thrashing like a madman trying to fix a common bug in both modules
(in out-of-synch copies of mymemreplace), and every time I think I fix
something "the other" module breaks.  The above appears to be why.

My opinion:  the test_strop.py test is in error, and so was strop_replace()
in stropmodule.c.  I'm checking in changes accordingly, but won't mind
getting yelled at if you disagree.




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