[Tutor] FW: find() problem

Steven D'Aprano steve at pearwood.info
Wed Aug 25 00:16:05 CEST 2010


On Wed, 25 Aug 2010 01:44:22 am Evert Rol wrote:

> Why are you returning -1 here?
> -1 is a valid list index.

So? str.find() does the same thing. It guarantees to only return 0 or 
positive indexes if it finds the substring, and only returns -1 to 
indicate not found.


-- 
Steven D'Aprano


More information about the Tutor mailing list