[Python-bugs-list] [ python-Bugs-493951 ] string.{starts,ends}with vs slices
noreply@sourceforge.net
noreply@sourceforge.net
Sun, 16 Dec 2001 11:24:24 -0800
Bugs item #493951, was opened at 2001-12-16 11:23
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=493951&group_id=5470
Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 7
Submitted By: Tim Peters (tim_one)
Assigned to: Barry Warsaw (bwarsaw)
Summary: string.{starts,ends}with vs slices
Initial Comment:
The attached test shows many cases where
string.startswith() and string.endswith() fail to
handle negative slice indices correctly. The failures
are in both the start and end indices. I stumbled
into this when tracking down why (what turned out to
be) this didn't work:
>>> file = 'difflib.pyc'
>>> file.endswith('.py', 0, -1) # should be 1
0
>>> file[0:-1].endswith('.py') # like this is
1
>>>
Can we risk changing this for 2.2? Don't know. If
not, reduce the priority.
----------------------------------------------------------------------
>Comment By: Tim Peters (tim_one)
Date: 2001-12-16 11:24
Message:
Logged In: YES
user_id=31435
Attached the test case.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=493951&group_id=5470