Bug in string.find; was: Re: Proposed PEP: New style indexing,was Re: Bug in slice type

Bryan Olson fakeaddress at nowhere.org
Sun Aug 28 16:19:07 EDT 2005


Steve Holden wrote:
 > Paul Rubin wrote:
 > We are arguing about trivialities here. Let's stop before it gets
 > interesting :-)

Some of us are looking beyond the trivia of what string.find()
should return, at an unfortunate interaction of Python features,
brought on by the special-casing of negative indexes. The wart
bites novice or imperfect Python programmers in simple cases
such as string.find(), or when their subscripts accidentally
fall off the low end. It bites programmers who want to fully
implement Python slicing, because of the double-and-
contradictory- interpretation of -1, as both an exclusive ending
bound and the index of the last element. It bites documentation
authors who naturally think of the non-negative subscript as
*the* index of a sequence item.


-- 
--Bryan



More information about the Python-list mailing list