[New-bugs-announce] [issue6780] startswith error message is incomplete
Sridhar Ratnakumar
report at bugs.python.org
Mon Aug 24 23:33:13 CEST 2009
New submission from Sridhar Ratnakumar <sridharr at activestate.com>:
The `startswith` method accepts both string and tuple (not list). Yet
the error message suggests that it expects (only) a character buffer
object.
In Python-2.6:
>>> "foo".startswith(['fo', 'df'])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: expected a character buffer object
In Python-3.x, the error message is different:
>>> "foo".startswith(["fo"])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Can't convert 'list' object to str implicitly
Aside: why not try to convert 'list' object to tuple?
----------
components: Library (Lib)
messages: 91942
nosy: srid
severity: normal
status: open
title: startswith error message is incomplete
type: behavior
versions: Python 2.6, Python 3.1
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6780>
_______________________________________
More information about the New-bugs-announce
mailing list