STINNER Victor <vstin...@python.org> added the comment:
The current behavior is really surprising. >>> "".replace("", "|") '|' >>> "".replace("", "|", -1) '|' vs >>> "".replace("", "|", 0) '' >>> "".replace("", "|", 1) '' >>> "".replace("", "|", 1000) '' I always expect "|". --- This behavior makes sense to me: >>> "abc".replace("", "|") '|a|b|c|' >>> "abc".replace("", "|", -1) '|a|b|c|' >>> "abc".replace("", "|", 0) 'abc' >>> "abc".replace("", "|", 1) '|abc' >>> "abc".replace("", "|", 100) '|a|b|c|' ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue28029> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com