Terry J. Reedy <[email protected]> added the comment:
Verified from Python.
>>> t = (1,2,3)
>>> t2 = t[:]
>>> id(t), id(t2)
(1672756229504, 1672756229504)
A partial slice cannot the original tuple, so I presume that the emphasis is
about returning a (new) *tuple*, rather than some sort of view of the original.
However,
Py_INCREF(a);
return (PyObject *)a;
date back to at least 1997 (GvR), so the optimization is not new. I don't know
what should replace 'New reference.' 'Old or new reverence.'?
"Take a slice of the tuple pointed to by p from low to high and return it **as
a new tuple**."
could be replaces with
"Return the slice of the tuple point to by p for low to high. If it is a
proper subslice, return a new tuple."
This leave it undefined when a complete slice.
----------
nosy: +terry.reedy
versions: -Python 3.5, Python 3.6
_______________________________________
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