This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author v+python
Recipients SilentGhost, Stéphane Henriot, ericvw, georg.brandl, martin.panter, r.david.murray, rhettinger, serhiy.storchaka, v+python, vstinner
Date 2020-04-02.05:30:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Thanks Stèphańe and Serhiy, I just discovered this strange behavior in 3.8, and wondered how my logic was wrong, until I pinpointed the inconsistent behaviour of str.replace with an empty first parameter and replace count of 1.

Glad to see it is fixed in 3.9.

I guess for   x.replace( a, b, c )  the workaround would be

x.replace( a, b, c ) if a else x.replace( a, b )

At least for recent versions of Python 3.
Date User Action Args
2020-04-02 05:30:09v+pythonsetrecipients: + v+python, georg.brandl, rhettinger, vstinner, ericvw, r.david.murray, SilentGhost, martin.panter, serhiy.storchaka, Stéphane Henriot
2020-04-02 05:30:08v+pythonsetmessageid: <>
2020-04-02 05:30:08v+pythonlinkissue28029 messages
2020-04-02 05:30:08v+pythoncreate