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

Wummel report at bugs.python.org
Tue Oct 16 14:45:03 CEST 2007


Wummel added the comment:

I also hit this bug. The .index() methods have the same issue,
as well as the methods in the string and strop modules:

>>> "123".index("2", None)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: slice indices must be integers or None
>> import strop, string
>>> strop.rfind("123", "2", None)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: an integer is required
>>> string.rfind("123", "2", None)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/string.py", line 374, in rfind
    return s.rfind(*args)
TypeError: slice indices must be integers or None
>>>

----------
nosy: +calvin

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


More information about the Python-bugs-list mailing list