Message365570
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:09 | v+python | set | recipients:
+ v+python, georg.brandl, rhettinger, vstinner, ericvw, r.david.murray, SilentGhost, martin.panter, serhiy.storchaka, Stéphane Henriot |
2020-04-02 05:30:08 | v+python | set | messageid: <1585805408.93.0.987889827534.issue28029@roundup.psfhosted.org> |
2020-04-02 05:30:08 | v+python | link | issue28029 messages |
2020-04-02 05:30:08 | v+python | create | |
|