[ python-Bugs-1520176 ] non-uniform behavior in 'startswith' / 'endswith'

SourceForge.net noreply at sourceforge.net
Mon Jul 10 22:15:11 CEST 2006


Bugs item #1520176, was opened at 2006-07-10 19:49
Message generated for change (Comment added) made by gbrandl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1520176&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Milind (t-milich)
>Assigned to: Raymond Hettinger (rhettinger)
Summary: non-uniform behavior in  'startswith' / 'endswith'

Initial Comment:
compare the two versions of 'endswith'.
Either  both of them should throw TypeErorr or both 
should return boolean value. 


>>> 'abc'.endswith( ('abc',None))

True

>>> 'abc'.endswith( ('abc',None),4,3)

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

TypeError: expected a character buffer object



----------------------------------------------------------------------

>Comment By: Georg Brandl (gbrandl)
Date: 2006-07-10 20:15

Message:
Logged In: YES 
user_id=849994

The current code shortcuts if it finds a match, so I think
this is not a bug. Raymond?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1520176&group_id=5470


More information about the Python-bugs-list mailing list