[issue1259] string find and rfind methods give a TypeError that is misleading

Facundo Batista report at bugs.python.org
Tue Oct 16 04:27:14 CEST 2007


Facundo Batista added the comment:

Documentation for find():

str.find(sub[, start[, end]])
    Return the lowest index in the string where substring sub is found,
such that sub is contained in the range [start, end]. Optional arguments
start and end are interpreted as in slice notation. Return -1 if sub is
not found.

I think that it shouldn't be possible to call it with None arguments. 

The error message is wrong: it's a TypeError, but the message should say
something like...

  TypeError: slice indices must be integers or have an __index__ method

If you're ok with this change, assign this bug to me and I'll fix it.

Regards,

----------
nosy: +facundobatista

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1259>
__________________________________


More information about the Python-bugs-list mailing list