is there a better way to check an array?
peter at engcorp.com
Fri Sep 2 17:15:11 CEST 2005
Mike Meyer wrote:
> "Steve M" <sjmaster at gmail.com> writes:
>>-returns the index into my_list of the first occurrence of candidate.
>>Returns -1 if candidate doesn't occur in my_list.
> Lists don't have a find method. strings do. Why is a good question.
Probably because at one point lists didn't even have the index() method,
and when it was suggested and (I believe) Raymond H. added it, I suspect
nobody also suggested that implementing find() was a good idea so it
And, given both that index() exists and the recent discussion about the
potential problems caused by find() returning a valid slice index when
it fails, maybe it's _not_ a good idea...
More information about the Python-list