[issue38557] PyTuple_GetSlice docs minor inaccuracy

2019-10-26 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38557] PyTuple_GetSlice docs minor inaccuracy

2019-10-26 Thread miss-islington


miss-islington  added the comment:


New changeset 4992dc6610fb354e36c0012a47ea9613b61c9038 by Miss Skeleton (bot) 
in branch '3.8':
bpo-38557: Improve documentation for list and tuple C API. (GH-16925)
https://github.com/python/cpython/commit/4992dc6610fb354e36c0012a47ea9613b61c9038


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38557] PyTuple_GetSlice docs minor inaccuracy

2019-10-26 Thread miss-islington


miss-islington  added the comment:


New changeset 334fc923b3a7a8d0d163692befd2a27b98b481df by Miss Skeleton (bot) 
in branch '3.7':
bpo-38557: Improve documentation for list and tuple C API. (GH-16925)
https://github.com/python/cpython/commit/334fc923b3a7a8d0d163692befd2a27b98b481df


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38557] PyTuple_GetSlice docs minor inaccuracy

2019-10-26 Thread miss-islington


miss-islington  added the comment:


New changeset 7356e10820b160d14b0ce0aba5427a8f9e757aa7 by Miss Skeleton (bot) 
in branch '2.7':
bpo-38557: Improve documentation for list and tuple C API. (GH-16925)
https://github.com/python/cpython/commit/7356e10820b160d14b0ce0aba5427a8f9e757aa7


--
nosy: +miss-islington

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38557] PyTuple_GetSlice docs minor inaccuracy

2019-10-26 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16464
pull_request: https://github.com/python/cpython/pull/16935

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38557] PyTuple_GetSlice docs minor inaccuracy

2019-10-26 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset d898d20e8c228229eb68e545f544db13f246f216 by Serhiy Storchaka in 
branch 'master':
bpo-38557: Improve documentation for list and tuple C API. (GH-16925)
https://github.com/python/cpython/commit/d898d20e8c228229eb68e545f544db13f246f216


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38557] PyTuple_GetSlice docs minor inaccuracy

2019-10-26 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16463
pull_request: https://github.com/python/cpython/pull/16934

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38557] PyTuple_GetSlice docs minor inaccuracy

2019-10-26 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16462
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/16933

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38557] PyTuple_GetSlice docs minor inaccuracy

2019-10-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The part about "new tuple" can be removed. The documentation olready contains 
an automatically generated note about a new reference.

PR 16925 improves the documentation for getting/setting items/slices of lists 
and tuples.

--
nosy: +serhiy.storchaka
stage: patch review -> 

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38557] PyTuple_GetSlice docs minor inaccuracy

2019-10-25 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +16455
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/16925

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38557] PyTuple_GetSlice docs minor inaccuracy

2019-10-25 Thread Terry J. Reedy


Terry J. Reedy  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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38557] PyTuple_GetSlice docs minor inaccuracy

2019-10-22 Thread wim glenn

New submission from wim glenn :

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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com