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 serhiy.storchaka
Recipients SilentGhost, Stéphane Henriot, ericvw, georg.brandl, martin.panter, r.david.murray, serhiy.storchaka, vstinner
Date 2019-10-29.07:56:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1572335780.0.0.310767073177.issue28029@roundup.psfhosted.org>
In-reply-to
Content
There are expected some relations between str methods. For example,

s.replace(a, b, n) == s.replace(a, b)   if n >= s.count(a)
len(s.replace(a, b, n)) == len(s) + (len(b)-len(a)) * n   if 0 <= n <= s.count(a)
len(s.replace(a, b, n)) == len(s) + (len(b)-len(a)) * s.count(a)   if n >= s.count(a)

Inconsistency between "".replace("", s, n) and "".replace("", s) is just a bug, and it should be fixed in the most consistent way. There are precedences, the behavior of replace() already was changed 3 times in the past. I think that chances to break some code are tiny, we just fix inconsistency why can puzzle users.
History
Date User Action Args
2019-10-29 07:56:20serhiy.storchakasetrecipients: + serhiy.storchaka, georg.brandl, vstinner, ericvw, r.david.murray, SilentGhost, martin.panter, Stéphane Henriot
2019-10-29 07:56:20serhiy.storchakasetmessageid: <1572335780.0.0.310767073177.issue28029@roundup.psfhosted.org>
2019-10-29 07:56:19serhiy.storchakalinkissue28029 messages
2019-10-29 07:56:19serhiy.storchakacreate