New submission from wim glenn <[email protected]>:
https://docs.python.org/3/c-api/tuple.html#c.PyTuple_GetSlice
In the c-api it says (emphasis mine):
PyObject* PyTuple_GetSlice(PyObject *p, Py_ssize_t low, Py_ssize_t high)ΒΆ
Return value: New reference.
Take a slice of the tuple pointed to by p from low to high and return it
**as a new tuple**.
But when slicing the entire tuple, CPython will return already existing
instance, not a new tuple.
https://github.com/python/cpython/blob/3.8/Objects/tupleobject.c#L448-L451
I propose the language in the docs be loosened so as not to tie the hands of
implementation
----------
assignee: docs@python
components: Documentation
messages: 355141
nosy: docs@python, wim.glenn
priority: normal
severity: normal
status: open
title: PyTuple_GetSlice docs minor inaccuracy
type: enhancement
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue38557>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com