On Wed, Apr 21, 2010 at 6:51 PM, Stef Mientki <stef.mien...@gmail.com> wrote:
>
> With the following code, I would expect a result of 5 !!
>
>>>> a= 'word1 word2 word3'
>>>> a.rfind(' ',7)
> 11
>
> Is this a bug ?

Python's documentation states:

 |  rfind(...)
 |      S.rfind(sub [,start [,end]]) -> int
 |
 |      Return the highest index in S where substring sub is found,
 |      such that sub is contained within s[start:end].  Optional
 |      arguments start and end are interpreted as in slice notation.
 |
 |      Return -1 on failure.

"Return the highest index in S"

I haven't looked at python's source code for the
str object, but perhaps this is exactly what it's
algorithm does!

cheers
James
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to