Another Wart! string.find() [ was: namespace issue? ]

Michael Powe michael+gnus at trollope.org
Fri Jun 22 10:27:52 EDT 2001


>>>>> "Steven" == Steven D Majewski <sdm7g at Virginia.EDU> writes:

    Steven> ( But I can't really think of a good reason for
    Steven> string.find to return -1 *except* that it wouldn't
    Steven> surprise a C programmer. )

Well, if we had boolean values, it could just return false!  I wonder
what percentage of the time string.find() is used just as I was using
it, to check for the existence of a substring rather than actually
doing something with it when found.  Maybe, we just need the python
equivalent of strchr() in C (returns a pointer or NULL, i.e., true or
false). 

mp



More information about the Python-list mailing list