Message355627
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. |
|
Date |
User |
Action |
Args |
2019-10-29 07:56:20 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, georg.brandl, vstinner, ericvw, r.david.murray, SilentGhost, martin.panter, Stéphane Henriot |
2019-10-29 07:56:20 | serhiy.storchaka | set | messageid: <1572335780.0.0.310767073177.issue28029@roundup.psfhosted.org> |
2019-10-29 07:56:19 | serhiy.storchaka | link | issue28029 messages |
2019-10-29 07:56:19 | serhiy.storchaka | create | |
|