[issue42451] Indicate in the docs that PyTuple_GetItem does not support negative indices

Antony Lee report at bugs.python.org
Tue Nov 24 04:41:26 EST 2020


New submission from Antony Lee <anntzer.lee at gmail.com>:

Unlike `PySequence_GetItem`, `PyTuple_GetItem` does not support negative indices ("indexing from the end").  That is fine, but warrants a notice in the docs (as that behavior is certainly not obvious).
The same wording as for `PyList_GetItem` (changing "list" to "tuple") should be good enough (`PyList_GetItem` currently states: "The position must be non-negative; indexing from the end of the list is not supported. If index is out of bounds (<0 or >=len(list)), return NULL and set an IndexError exception.")

----------
assignee: docs at python
components: C API, Documentation
messages: 381716
nosy: Antony.Lee, docs at python
priority: normal
severity: normal
status: open
title: Indicate in the docs that PyTuple_GetItem does not support negative indices
versions: Python 3.10

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


More information about the Python-bugs-list mailing list