New submission from Mark Cline:

The Title might be a bit awkward but this is what I mean:

before = ',,,,'
after = before.replace(',,', ',null,')
print(after)
>,null,,null,

I suspect it is starting the second search at the start of the first find + 
length of the find? ie:
,,,,
0123
Starting the next search at spot 2 (the 3rd ,).

This might be expected behaviour as it is looking at the rest of the string 
after finding the match, as opposed to taking the updated string:
,null,,, after the first replace. (Actually, writing that out it does make 
sense that it would behave like this, but thought I would mention just in case 
I am missing something). 

[Its easy enough to work around it, but just thought I would mention it :D]

----------
components: Library (Lib)
messages: 256877
nosy: Mark Cline
priority: normal
severity: normal
status: open
title: When doing string.replace, it uses the entire 'find' string and doesn't 
let it get reused...
type: behavior
versions: Python 3.5

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25929>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to