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 Stéphane Henriot
Recipients SilentGhost, Stéphane Henriot
Date 2016-09-08.20:54:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1473368058.37.0.295307810774.issue28029@psf.upfronthosting.co.za>
In-reply-to
Content
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) :(
History
Date User Action Args
2016-09-08 20:54:18Stéphane Henriotsetrecipients: + Stéphane Henriot, SilentGhost
2016-09-08 20:54:18Stéphane Henriotsetmessageid: <1473368058.37.0.295307810774.issue28029@psf.upfronthosting.co.za>
2016-09-08 20:54:18Stéphane Henriotlinkissue28029 messages
2016-09-08 20:54:18Stéphane Henriotcreate