[issue28029] Replace and empty strings

2016-09-09 Thread Stéphane Henriot
Changes by Stéphane Henriot : -- nosy: +georg.brandl ___ Python tracker <http://bugs.python.org/issue28029> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue28029] Replace and empty strings

2016-09-08 Thread Stéphane Henriot
Stéphane Henriot added the comment: I understand it might be a rather rare case. Nevertheless, don't you think the inconsistency Serhiy pointed out makes it look like a bug needing a fix? -- ___ Python tracker <http://bugs.python.org/is

[issue28029] Replace and empty strings

2016-09-08 Thread Stéphane Henriot
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 s

[issue28029] Replace and empty strings

2016-09-08 Thread Stéphane Henriot
Stéphane Henriot added the comment: For what it's worth, here is the behavior in PyPy 2.2.1 >>>> "".replace("", "prefix", 1) 'prefix' >>>> "".replace("", "prefix") 'prefix&

[issue28029] Replace and empty strings

2016-09-08 Thread Stéphane Henriot
New submission from Stéphane Henriot: A few days ago, the following behavior surprised me. >>> "".replace("", "prefix", 1) '' >>> "".replace("", "prefix") 'prefix' It seems to me this edge case