Re: Inconsistent behaviour os str.find/str.index when providing optional parameters

2012-11-22 Thread Joshua Landau
If you reply through Google Groups, please be careful not to do it the traditional way as us poor saps get hundreds of lines of ">" added in. I believe (but this is mere recollection) that a good way to use the site is by selecting the text you want to quote before replying (even if it is the whol

Re: Inconsistent behaviour os str.find/str.index when providing optional parameters

2012-11-22 Thread Giacomo Alzetta
Il giorno giovedì 22 novembre 2012 09:44:21 UTC+1, Steven D'Aprano ha scritto: > On Wed, 21 Nov 2012 23:01:47 -0800, Giacomo Alzetta wrote: > > > > > Il giorno giovedì 22 novembre 2012 05:00:39 UTC+1, MRAB ha scritto: > > >> On 2012-11-22 03:41, Terry Reedy wrote: It can't return 5 because 5 >

Re: Inconsistent behaviour os str.find/str.index when providing optional parameters

2012-11-22 Thread Steven D'Aprano
On Wed, 21 Nov 2012 23:01:47 -0800, Giacomo Alzetta wrote: > Il giorno giovedì 22 novembre 2012 05:00:39 UTC+1, MRAB ha scritto: >> On 2012-11-22 03:41, Terry Reedy wrote: It can't return 5 because 5 >> isn't an index in 'spam'. >> >> >> >> It can't return 4 because 4 is below the start index.

Re: Inconsistent behaviour os str.find/str.index when providing optional parameters

2012-11-21 Thread Giacomo Alzetta
Il giorno giovedì 22 novembre 2012 05:00:39 UTC+1, MRAB ha scritto: > On 2012-11-22 03:41, Terry Reedy wrote: > It can't return 5 because 5 isn't an index in 'spam'. > > > > It can't return 4 because 4 is below the start index. Uhm. Maybe you are right, because returning a greater value would c

Re: Inconsistent behaviour os str.find/str.index when providing optional parameters

2012-11-21 Thread MRAB
On 2012-11-22 03:41, Terry Reedy wrote: On 11/21/2012 8:32 AM, MRAB wrote: On 2012-11-21 12:43, Giacomo Alzetta wrote: I just came across this: >>> 'spam'.find('') 0 >>> 'spam'.find('', 1) 1 >>> 'spam'.find('', 4) 4 'spam'.find('', 5) -1 Now, reading find's documentation: print(s

Re: Inconsistent behaviour os str.find/str.index when providing optional parameters

2012-11-21 Thread Terry Reedy
On 11/21/2012 8:32 AM, MRAB wrote: On 2012-11-21 12:43, Giacomo Alzetta wrote: I just came across this: >>> 'spam'.find('') 0 >>> 'spam'.find('', 1) 1 >>> 'spam'.find('', 4) 4 'spam'.find('', 5) -1 Now, reading find's documentation: print(str.find.__doc__) S.find(sub [,start [,end]]) -

Re: Inconsistent behaviour os str.find/str.index when providing optional parameters

2012-11-21 Thread Joshua Landau
On 21 November 2012 20:58, MRAB wrote: > On 2012-11-21 19:25, Hans Mulder wrote: > >> On 21/11/12 17:59:05, Alister wrote: >> >>> On Wed, 21 Nov 2012 04:43:57 -0800, Giacomo Alzetta wrote: 'spam'.find('', 5) >>> >> -1 Now, reading find's documentation: pr

Re: Inconsistent behaviour os str.find/str.index when providing optional parameters

2012-11-21 Thread MRAB
On 2012-11-21 19:25, Hans Mulder wrote: On 21/11/12 17:59:05, Alister wrote: On Wed, 21 Nov 2012 04:43:57 -0800, Giacomo Alzetta wrote: I just came across this: 'spam'.find('', 5) -1 Now, reading find's documentation: print(str.find.__doc__) S.find(sub [,start [,end]]) -> int Return t

Re: Inconsistent behaviour os str.find/str.index when providing optional parameters

2012-11-21 Thread Giacomo Alzetta
Il giorno mercoledì 21 novembre 2012 20:25:10 UTC+1, Hans Mulder ha scritto: > On 21/11/12 17:59:05, Alister wrote: > > > On Wed, 21 Nov 2012 04:43:57 -0800, Giacomo Alzetta wrote: > > > > > >> I just came across this: > > >> > > > 'spam'.find('', 5) > > >> -1 > > >> > > >> > > >> Now

Re: Inconsistent behaviour os str.find/str.index when providing optional parameters

2012-11-21 Thread Hans Mulder
On 21/11/12 17:59:05, Alister wrote: > On Wed, 21 Nov 2012 04:43:57 -0800, Giacomo Alzetta wrote: > >> I just came across this: >> > 'spam'.find('', 5) >> -1 >> >> >> Now, reading find's documentation: >> > print(str.find.__doc__) >> S.find(sub [,start [,end]]) -> int >> >> Return the lowe

Re: Inconsistent behaviour os str.find/str.index when providing optional parameters

2012-11-21 Thread Alister
On Wed, 21 Nov 2012 04:43:57 -0800, Giacomo Alzetta wrote: > I just came across this: > 'spam'.find('', 5) > -1 > > > Now, reading find's documentation: > print(str.find.__doc__) > S.find(sub [,start [,end]]) -> int > > Return the lowest index in S where substring sub is found, > su

Re: Inconsistent behaviour os str.find/str.index when providing optional parameters

2012-11-21 Thread MRAB
On 2012-11-21 12:43, Giacomo Alzetta wrote: I just came across this: 'spam'.find('', 5) -1 Now, reading find's documentation: print(str.find.__doc__) S.find(sub [,start [,end]]) -> int Return the lowest index in S where substring sub is found, such that sub is contained within S[start:en

Inconsistent behaviour os str.find/str.index when providing optional parameters

2012-11-21 Thread Giacomo Alzetta
I just came across this: >>> 'spam'.find('', 5) -1 Now, reading find's documentation: >>> print(str.find.__doc__) S.find(sub [,start [,end]]) -> int Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are