Re: [Python-ideas] Revisiting str.rreplace()

2018-07-21 Thread Chris Barker - NOAA Federal via Python-ideas
I starting g reading this thread in the middle, on a phone. But was very confused for a while because I didn’t notice that there were two ‘r’s at the beginning of .rreplace Just sayin’ -CHB Sent from my iPhone > On Jul 19, 2018, at 9:29 AM, Paul Moore wrote: > >> On 19 July 2018 at 16:25,

Re: [Python-ideas] Revisiting str.rreplace()

2018-07-19 Thread Paul Moore
On 19 July 2018 at 16:25, Eric V. Smith wrote: > It currently does something: it replaces all instances, just as if you > hadn't supplied a count (see my example below). You can't change its > behavior. ... without a deprecation cycle. Which is of course not worth it for something which could

Re: [Python-ideas] Revisiting str.rreplace()

2018-07-19 Thread Eric V. Smith
On 7/19/2018 11:22 AM, Calvin Spealman wrote: If its treated as a missing parameter, and currently doesn't do anything, then it wouldn't be used... right? and it could be safe to add behavior for it... right? It currently does something: it replaces all instances, just as if you hadn't

Re: [Python-ideas] Revisiting str.rreplace()

2018-07-19 Thread MRAB
On 2018-07-19 16:22, Calvin Spealman wrote: If its treated as a missing parameter, and currently doesn't do anything, then it wouldn't be used... right? and it could be safe to add behavior for it... right? Are you sure that it wouldn't break some existing code? Plus, we already have

Re: [Python-ideas] Revisiting str.rreplace()

2018-07-19 Thread Calvin Spealman
If its treated as a missing parameter, and currently doesn't do anything, then it wouldn't be used... right? and it could be safe to add behavior for it... right? On Thu, Jul 19, 2018 at 11:17 AM, Eric V. Smith wrote: > On 7/19/2018 10:01 AM, Calvin Spealman wrote: > >> As an alternative

Re: [Python-ideas] Revisiting str.rreplace()

2018-07-19 Thread Eric V. Smith
On 7/19/2018 10:01 AM, Calvin Spealman wrote: As an alternative suggestion: What if the count parameter to str.replace() counted from the right with negative values? That would be consistent with other things like indexing and slicing. We couldn't make this change because negative values

Re: [Python-ideas] Revisiting str.rreplace()

2018-07-19 Thread Calvin Spealman
It would be consistent to apply it to other functions and I'd be in favour of that, yes. On Thu, Jul 19, 2018 at 10:06 AM, Eric Fahlgren wrote: > On Thu, Jul 19, 2018 at 7:01 AM Calvin Spealman > wrote: > >> As an alternative suggestion: What if the count parameter to >> str.replace() counted

Re: [Python-ideas] Revisiting str.rreplace()

2018-07-19 Thread Eric Fahlgren
On Thu, Jul 19, 2018 at 7:01 AM Calvin Spealman wrote: > As an alternative suggestion: What if the count parameter to str.replace() > counted from the right with negative values? That would be consistent with > other things like indexing and slicing. > ​That could certainly be made to work, but

Re: [Python-ideas] Revisiting str.rreplace()

2018-07-19 Thread Calvin Spealman
As an alternative suggestion: What if the count parameter to str.replace() counted from the right with negative values? That would be consistent with other things like indexing and slicing. On Thu, Jul 19, 2018 at 9:47 AM, Eric Fahlgren wrote: > On Wed, Jul 18, 2018 at 8:20 PM Graham Gott com>

Re: [Python-ideas] Revisiting str.rreplace()

2018-07-19 Thread Eric Fahlgren
On Wed, Jul 18, 2018 at 8:20 PM Graham Gott wrote: > > Thoughts? Support/oppose? > ​ +1, along with an overall rework of str methods to make them more consistent. The find, replace and split families should all gain the same tuple-as-search-string that endswith and startswith use. (Discussed

[Python-ideas] Revisiting str.rreplace()

2018-07-18 Thread Graham Gott
This was previously proposed here in 2014 < https://mail.python.org/pipermail/python-ideas/2014-January/025091.html>, but the discussion fizzled out. To me, str.rreplace() is an obvious and necessary complement to str.replace(), just as str.rsplit() is a complement to str.split(). It would make