[Python-ideas] Default return values to int and float
Ethan Furman
ethan at stoneleaf.us
Wed Oct 5 17:06:07 CEST 2011
Ron Adam wrote:
> I really don't like the '-1' for a not found case. They just get in the
> way.
>
> If len(s) was the not found case, you get a value that can be used in a
> slice without first checking the index, or catching an exception.
So every time we want to know if s.find() failed, we have to compare to
len(s)?
No thanks.
~Ethan~
More information about the Python-ideas
mailing list