[Python-bugs-list] [ python-Bugs-661913 ] str.index() exception message not consistent
SourceForge.net
noreply@sourceforge.net
Fri, 03 Jan 2003 15:20:59 -0800
Bugs item #661913, was opened at 2003-01-03 23:20
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=661913&group_id=5470
Category: Python Interpreter Core
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Inyeol Lee (inyeol)
Assigned to: Nobody/Anonymous (nobody)
Summary: str.index() exception message not consistent
Initial Comment:
$ python
Python 2.3a1 (#1, Jan 2 2003, 22:36:29)
[GCC 2.95.3 20010315 (release)] on sunos5
Type "help", "copyright", "credits" or "license" for
more information.
>>> 'a'.index('b')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ValueError: substring not found in string.index
>>> 'a'.rindex('b')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ValueError: substring not found in string.rindex
>>> u'a'.index('b')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ValueError: substring not found
>>>
str.index()/str.rindex() exception message contains
"in string.(r)index", but
unicode.index()/unicode.rindex()
doesn't.
For me, unicode message is more clear, and it is
consistent with other string methods which raises
exception, for example;
>>> 'a'.split('')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ValueError: empty separator
>>>
2.2.2 has the same issues.
Inyeol Lee
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=661913&group_id=5470