[issue28029] Replace and empty strings

2016-09-09 Thread Stéphane Henriot
Changes by Stéphane Henriot <shl...@gmail.com>: -- nosy: +georg.brandl ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28029> ___ _

[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 <rep...@bugs.python.org>

[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 string

[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 isn't correctly docu