PEP 285: Adding a bool type

Paul Rubin phr-n2002a at nightsong.com
Mon Apr 1 19:32:29 EST 2002


Chris Barker <Chris.Barker at noaa.gov> writes:
> By the way, here is an example of why the current sytem is bad:
> 
> string.find() returns the index of the found string, and 0 being a
> perfectly valid index, it can NOT be used to return an indication
> that the substring was not found, so -1 is returned instead. None
> could not be returned to mean not found, because both 0 and None
> would resolve as false.  I'd love to see False be returned, and then
> you could do:
> 
> if string.find(...):
> 	do something.

Are you proposing to start making 0 resolve as true?  If not, returning
False has the same problem as returning None.



More information about the Python-list mailing list