R. David Murray added the comment:

You have to remember that the most useful way to think about python slice 
indexes is that they point between characters. Consider, for example, that you 
have a starting index of something, and you are looking backward in the string 
for a trailing delimiter:

  >>> x = 'this is <weird example> of something'
  >>> x.rfind('>', 9)
  22
  >>> x[9:22]
  'weird example'

So the above is why 5 is different from 7: 5 is the index that you would use in 
a slice if you wanted the string that ended before the match...and the match in 
the null string case is the end of the string.  That is, Python is being 
consistent in this degenerate case.

----------

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

Reply via email to