[issue22237] sorted() docs should state that the sort is stable

2014-10-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d44f7d229e00 by Ezio Melotti in branch '2.7':
#22237: document that sorted() is guaranteed to be stable.  Initial patch by 
Martin Panter.
https://hg.python.org/cpython/rev/d44f7d229e00

New changeset 5dd4906daa62 by Ezio Melotti in branch '3.4':
#22237: document that sorted() is guaranteed to be stable.  Initial patch by 
Martin Panter.
https://hg.python.org/cpython/rev/5dd4906daa62

New changeset b01568e2597e by Ezio Melotti in branch 'default':
#22237: merge with 3.4.
https://hg.python.org/cpython/rev/b01568e2597e

--
nosy: +python-dev

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



[issue22237] sorted() docs should state that the sort is stable

2014-10-28 Thread Ezio Melotti

Ezio Melotti added the comment:

Fixed, thanks for the patch!

--
assignee: rhettinger - ezio.melotti
nosy: +ezio.melotti
resolution:  - fixed
stage:  - resolved
status: open - closed

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



[issue22237] sorted() docs should state that the sort is stable

2014-10-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset af8f678a4a75 by Ezio Melotti in branch '2.7':
#22237: fix patch attribution.
https://hg.python.org/cpython/rev/af8f678a4a75

New changeset 2f697bcc8f86 by Ezio Melotti in branch '3.4':
#22237: fix patch attribution.
https://hg.python.org/cpython/rev/2f697bcc8f86

New changeset 7e870ddd1989 by Ezio Melotti in branch 'default':
#22237: merge patch attribution fix.
https://hg.python.org/cpython/rev/7e870ddd1989

--

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



[issue22237] sorted() docs should state that the sort is stable

2014-10-26 Thread Martin Panter

Martin Panter added the comment:

The new text seems reasonable to me on its own, however I still think the 
heapsort() docstring needs updating as well

--

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



[issue22237] sorted() docs should state that the sort is stable

2014-10-25 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

ping.

--

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



[issue22237] sorted() docs should state that the sort is stable

2014-10-15 Thread Mark Dickinson

Mark Dickinson added the comment:

 when I grep the code, I don't find it

The non-greppability is due to preprocessor evil. The culprit is this macro 
from Include/object.h:

  #define _Py_IDENTIFIER(varname) _Py_static_string(PyId_##varname, #varname)

along with the declaration

  _Py_IDENTIFIER(sort);

earlier in bltinmodule.c.

--
nosy: +mark.dickinson

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



[issue22237] sorted() docs should state that the sort is stable

2014-10-15 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

Hi Mark,

Without your explanation, I was really lost.

Thank you.

--

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



[issue22237] sorted() docs should state that the sort is stable

2014-10-15 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

My patch for the documentation of Python 3.5, just need a small feedback.

If you agree with this patch, I will provide the same patch for 2.7 and 3.4

Thank you

--
keywords: +patch
Added file: http://bugs.python.org/file36933/issue22237.patch

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



[issue22237] sorted() docs should state that the sort is stable

2014-10-14 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

For this issue, I have read the source code of sorted and list.sort to be 
sure they use the same algorithm (not sure). But in the builtin_sorted 
function, I read PyId_sort, but when I grep the code, I don't find it. Where 
can I find the reference of this function?

Thank you.

--
nosy: +matrixise

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



[issue22237] sorted() docs should state that the sort is stable

2014-10-14 Thread Georg Brandl

Georg Brandl added the comment:

PyId_sort is not a function, it's a somewhat complicated way of getting a 
Python string sort (in this case, for looking up a method using 
PyObject_GetAttrId).  The string object is cached, with is faster than 
constructing one every time with PyObject_GetAttrString.

--

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



[issue22237] sorted() docs should state that the sort is stable

2014-08-22 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I'll update the docs for sorted().

--
priority: normal - low
versions:  -Python 3.1, Python 3.2, Python 3.3

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



[issue22237] sorted() docs should state that the sort is stable

2014-08-21 Thread Martin Panter

Martin Panter added the comment:

It looks like a fork of that how-to is actually part of the documentation: 
https://docs.python.org/release/3.4.0/howto/sorting.html. Perhaps the two 
should be linked better.

If “sorted” is indeed meant to be stable, that makes the docstring for the 
“heapsort” function 
https://docs.python.org/release/3.4.0/library/heapq.html#basic-examples 
invalid. That function is not stable, for example: heapsort((0, 0, False, 0)) 
- [0, False, 0, 0].

Also, the how-to implicitly guarantees that only less-than (__lt__) is required 
for comparison. This is already documented for “list.sort”, but it might be 
good to add that guarantee to the “sorted” reference. Maybe also clarify if it 
applies (or not) to other sorting and comparison routines (e.g. heapq, bisect, 
min, max), though maybe that is straying off scope for this bug.

--
nosy: +vadmium

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



[issue22237] sorted() docs should state that the sort is stable

2014-08-20 Thread Wilfred Hughes

New submission from Wilfred Hughes:

According to 
https://wiki.python.org/moin/HowTo/Sorting/#Sort_Stability_and_Complex_Sorts 
and Alex Martelli: http://stackoverflow.com/q/1915376/509706, Python's sorted() 
is stable. It would be great to update the docs for sorted() to state this.

--
assignee: docs@python
components: Documentation
messages: 225574
nosy: Wilfred.Hughes, docs@python
priority: normal
severity: normal
status: open
title: sorted() docs should state that the sort is stable
type: enhancement
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5

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



[issue22237] sorted() docs should state that the sort is stable

2014-08-20 Thread Georg Brandl

Georg Brandl added the comment:

I agree: The docs for list.sort() do guarantee the stability, so sorted() 
should have the same indication.

--
nosy: +georg.brandl

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



[issue22237] sorted() docs should state that the sort is stable

2014-08-20 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
assignee: docs@python - rhettinger
nosy: +rhettinger

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