[issue25929] When doing string.replace, it uses the entire 'find' string and doesn't let it get reused...

2015-12-22 Thread R. David Murray

R. David Murray added the comment:

No, you aren't missing anything, it is working as designed.

--
nosy: +r.david.murray
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25929] When doing string.replace, it uses the entire 'find' string and doesn't let it get reused...

2015-12-22 Thread Mark Cline

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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com