[New-bugs-announce] [issue13340] list.index does not accept None as start or stop

Carl Friedrich Bolz report at bugs.python.org
Fri Nov 4 10:23:04 CET 2011


New submission from Carl Friedrich Bolz <cfbolz at gmx.de>:

The list.index method does not accept None as start and stop, which makes the error message quite confusing:

>>> [1, 2, 3].index(2, None, None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: slice indices must be integers or None or have an __index__ method

I checked this in 3.2.2 and 2.7.2. Seems similar to #12163.

----------
messages: 147000
nosy: Carl.Friedrich.Bolz
priority: normal
severity: normal
status: open
title: list.index does not accept None as start or stop
type: behavior
versions: Python 2.7, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13340>
_______________________________________


More information about the New-bugs-announce mailing list