[New-bugs-announce] [issue43836] range.index doesn't support start/stop optional arguments

Kaleb Barrett report at bugs.python.org
Wed Apr 14 00:11:46 EDT 2021


New submission from Kaleb Barrett <dev.ktbarrett at gmail.com>:

The range builtin type is a collections.abc.Sequence, which in Python 3.5 added the optional start and stop arguments to the index method of Sequences. However, range.index does not support these optional arguments required by Sequence.

I noticed this when creating a wrapper type around range which was a  Sequence. mypy complained 'Signature of "index" incompatible with supertype "Sequence"', but attempting to pass the values raised 'TypeError: index() takes exactly one argument (3 given)'.

----------
components: Library (Lib)
messages: 391029
nosy: ktbarrett
priority: normal
severity: normal
status: open
title: range.index doesn't support start/stop optional arguments
type: behavior
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43836>
_______________________________________


More information about the New-bugs-announce mailing list