Lawrence D'Oliveiro wrote:

> Fine if it only happened once. But it's a commonly-made mistake. At some
> point you have to conclude that not all those people are stupid, there
> really is something wrong with the design.

I think "something wrong with the design" is overstating the case a bit, and is likely to elicit some negative reactions in this forum. But I agree with your point, to this extent: this situation illustrates the way in which Python "overloads" the number zero:

 Realm A:  "0" indicates the first position in a sequence
 Realm B:   "0" indicates the Boolean value "False"

You just need to remember that the find() function works in Realm A, and the "in" operator works in Realm B.

Q: Has anyone on the python-dev list ever proposed a "string"-module function that does the job of the "in" operator? Maybe this:

 if test.contains(item)     # would return a Boolean value

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to