[Python-3000] Droping find/rfind? (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Wed Aug 23 09:35:00 CEST 2006
- Previous message: [Python-3000] Droping find/rfind?
- Next message: [Python-3000] Droping find/rfind?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Josiah Carlson wrote:
One of the issues with the -1 return on find failure is that it is ambiguous, one must really check for a -1 return. Here's an API that is non-ambiguous:
An alternative would be to return None for not found. It wouldn't solve the problem of people using the return value as a boolean, but at least you'd get an exception if you tried to use the not-found value as an index.
Or maybe it could return index values as a special int subclass that always tests true even when it's zero...
-- Greg
- Previous message: [Python-3000] Droping find/rfind?
- Next message: [Python-3000] Droping find/rfind?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]