[issue13742] Add a key parameter (like sorted) to heapq.merge

2015-01-10 Thread Terry J. Reedy

Terry J. Reedy added the comment:

You can set up mecurial on your machine, make a read-only clone of the cpython 
repository, and compile it just as do other people, whether core-developers or 
otherwise.  See docs.python.org/devguide for details.

--

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2015-01-09 Thread Berker Peksag

Berker Peksag added the comment:

Hi Tommy, the patch is already committed to Python 3.5. See 
https://docs.python.org/3.5/library/heapq.html#heapq.merge

--
nosy: +berker.peksag
stage: patch review - resolved

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2015-01-09 Thread Tommy Carstensen

Tommy Carstensen added the comment:

I noticed 3.5 alpha1 is not released until February 1st. Is there any way I can 
get my hands on this new functionality?

--
nosy: +Tommy.Carstensen

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2015-01-09 Thread Tommy Carstensen

Tommy Carstensen added the comment:

Yes, but 3.5 has not been pre-released yet.

--

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2014-05-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f5521f5dec4a by Raymond Hettinger in branch 'default':
Issue #13742:  Add key and reverse parameters to heapq.merge()
http://hg.python.org/cpython/rev/f5521f5dec4a

--
nosy: +python-dev

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2014-05-30 Thread Raymond Hettinger

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


--
resolution:  - fixed
status: open - closed

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2014-05-29 Thread Raymond Hettinger

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


Added file: http://bugs.python.org/file35398/keymerge2.diff

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2014-05-29 Thread Raymond Hettinger

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


Removed file: http://bugs.python.org/file35398/keymerge2.diff

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2014-05-29 Thread Raymond Hettinger

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


Added file: http://bugs.python.org/file35399/keymerge2.diff

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2014-05-26 Thread Raymond Hettinger

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


--
versions: +Python 3.5 -Python 3.4

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2014-05-26 Thread Raymond Hettinger

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


Added file: http://bugs.python.org/file35374/keymerge.diff

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2014-05-12 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


--
nosy: +eric.snow

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2013-04-29 Thread Raymond Hettinger

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


--
priority: low - normal
Added file: http://bugs.python.org/file30062/heap2.diff

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2013-04-29 Thread Raymond Hettinger

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


Added file: http://bugs.python.org/file30063/heap2.diff

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2013-04-29 Thread Raymond Hettinger

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


Removed file: http://bugs.python.org/file30062/heap2.diff

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2013-04-29 Thread Mark Dickinson

Mark Dickinson added the comment:

heap2.diff contains only a single line's change.  Wrong file attached?

--
nosy: +mark.dickinson

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2013-04-29 Thread Mark Dickinson

Mark Dickinson added the comment:

Ah, I see the new file now (I'd failed to refresh my browser);  sorry for the 
noise.

--

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2013-04-29 Thread Mark Dickinson

Mark Dickinson added the comment:

Looks pretty good to me.

- There's a bonus print call in the diff.

- Should the len(self._data) call be protected by the lock?  I can't 
immediately think of any reason why that would be necessary (e.g., pushpop nd 
poppush never change the size of self._data, so there's no risk of getting a 
bogus length there), but the lack of the lock makes me nervous.

- Support for iter() seems a bit out of place to me.  What are the use-cases 
for this?  Would it make sense to leave this out (for now)?

--

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2013-04-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

There is already one heap class in the stdlib: queue.PriorityQueue. Why create 
a duplicate instead extend queue.PriorityQueue with desired features?

May be name the maxheap parameter as reverse?

--
nosy: +serhiy.storchaka

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2013-03-26 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Attaching a rough draft implementation for a fully encapsulated Heap() class 
that is thread-safe, supports minheaps and maxheaps, and efficiently implements 
key-functions (called no more than once per key).

--
Added file: http://bugs.python.org/file29578/heap.diff

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2012-08-13 Thread Simon Sapin

Simon Sapin added the comment:

I just remembered about this. I suppose it is too late for 3.3?

--

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2012-08-13 Thread Éric Araujo

Éric Araujo added the comment:

Yes, 3.3 is already in beta.

--
keywords: +needs review
stage:  - patch review
versions: +Python 3.4 -Python 3.3

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2012-02-09 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

FWIW, Guido approves of the idea, msg152969 in #4356

--
nosy: +terry.reedy

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2012-02-07 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2012-02-06 Thread Raymond Hettinger

Raymond Hettinger raymond.hettin...@gmail.com added the comment:

I'll look at this in the next couple of weeks.  Hang tight :-)

--

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2012-01-16 Thread Simon Sapin

Simon Sapin simon.sa...@kozea.fr added the comment:

heapq_merge_key_duplicate.patch is a new patch with two code path. It also 
updates the function’s docstring (which the previous patch did not). Raymond, 
do you think the speed is worth the DRY violation?

--
Added file: http://bugs.python.org/file24248/heapq_merge_key_duplicate.patch

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2012-01-09 Thread Simon Sapin

New submission from Simon Sapin simon.sa...@kozea.fr:

Hi,

The attached patch adds a 'key' optional parameter to the heapq.merge function 
that behaves as in sorted().

Related discussion: 
http://mail.python.org/pipermail/python-ideas/2012-January/013295.html

This is my first contribution to CPython.

--
components: Library (Lib)
files: heapq_merge_key.patch
keywords: patch
messages: 150927
nosy: SimonSapin, rhettinger
priority: normal
severity: normal
status: open
title: Add a key parameter (like sorted) to heapq.merge
type: enhancement
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file24184/heapq_merge_key.patch

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2012-01-09 Thread Simon Sapin

Simon Sapin simon.sa...@kozea.fr added the comment:

The attached script benchmarks the basline (current implementation) against 3 
new implementations, as suggested on 
http://mail.python.org/pipermail/python-ideas/2012-January/013296.html

On my machine, the output is:

merge_baseline
per run, min of 3 = 7.527 ms

merge_1
per run, min of 3 = 9.894 ms
131.449 % of baseline

merge_2
per run, min of 3 = 7.948 ms
105.594 % of baseline

merge_3
per run, min of 3 = 7.581 ms
100.716 % of baseline

On this particular input, merge_2 adds 6% of overhead when the key parameter is 
not used. While merge_3 only adds 1% of overhead, it almost doubles the amount 
of code. (Which was admittedly not that long to begin with.)

The patch in the previous message is with the merge_2 implementation, which 
seemed like the best compromise to me.

--
Added file: http://bugs.python.org/file24185/benchmark_heapq_merge.py

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2012-01-09 Thread Eric V. Smith

Changes by Eric V. Smith e...@trueblade.com:


--
assignee:  - rhettinger

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2012-01-09 Thread Simon Sapin

Simon Sapin simon.sa...@kozea.fr added the comment:

Oops, the patch to the documentation would also need 'New in 3.3: the key 
parameter', with the right Sphinx directive. But that depends on whether this 
change ends up in 3.3 or 3.4.

Does 3.3 still get new features?

--

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2012-01-09 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Yes, 3.3 is still in the early development stage, and new features will be 
accepted until the first beta (in June, see PEP 398).  “.. versionadded:: 3.3 
The *key* parameter” will do.

--
nosy: +eric.araujo
versions:  -Python 3.4

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2012-01-09 Thread Daniel Stutzbach

Changes by Daniel Stutzbach stutzb...@google.com:


--
nosy: +stutzbach

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2012-01-09 Thread Raymond Hettinger

Raymond Hettinger raymond.hettin...@gmail.com added the comment:

Simon, please keep the original version fast by creating two code paths:

   if key is None:
  original_code
   else:
  new_code using the key_function

--
priority: normal - low

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2012-01-09 Thread Simon Sapin

Simon Sapin simon.sa...@kozea.fr added the comment:

Raymond, please have a look at merge_3 in benchmark_heapq_merge.py. It is 
implemented as you say.

Do you think the speed is worth the code duplication?

--

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