Stéphane Henriot added the comment: Thanks for your help.
However, I'm not sure I would agree, regarding the correct behavior. I guess the main question is « What is an occurrence? ». Are you not convinced that in, count and find indicate occurrences? To my understanding, the empty string occurs basically everywhere in strings (including beginning and end): >>> "blabla".replace("", "ε") 'εbεlεaεbεlεaε' To give a bit more (useless?) context, I was implementing a GCD algorithm based on replacements by Knuth (very beginning of TAOCP) and it looks like the current cpython implementation gives 0 for gcd(1, 1) :( ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28029> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com