[issue31145] PriorityQueue.put() fails with TypeError if priority_number in tuples of (priority_number, data) are the same.

2018-01-11 Thread Raymond Hettinger
Change by Raymond Hettinger : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue31145] PriorityQueue.put() fails with TypeError if priority_number in tuples of (priority_number, data) are the same.

2018-01-11 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 0c3be9651f4f149f4a78bb7043d26db9e75cabc0 by Raymond Hettinger in branch 'master': bpo-31145: Use dataclasses to create a prioritization wrapper (#5153)

[issue31145] PriorityQueue.put() fails with TypeError if priority_number in tuples of (priority_number, data) are the same.

2018-01-11 Thread Raymond Hettinger
Change by Raymond Hettinger : -- keywords: +patch pull_requests: +5008 stage: -> patch review ___ Python tracker ___

[issue31145] PriorityQueue.put() fails with TypeError if priority_number in tuples of (priority_number, data) are the same.

2017-12-04 Thread Raymond Hettinger
Raymond Hettinger added the comment: FWIW, the new dataclasses module makes it really easy to create a wrapper: from dataclasses import dataclass, field from typing import Any @dataclass(order=True) class KeyedItem: key: int item:

[issue31145] PriorityQueue.put() fails with TypeError if priority_number in tuples of (priority_number, data) are the same.

2017-09-26 Thread Lisa Roach
Lisa Roach added the comment: I think it is a good idea to have a simple way to add a value to sort on in general, it could have some interesting use-cases. Also I am with Nick a name change would make the broader scope clearer. What I am not sure about is making the

[issue31145] PriorityQueue.put() fails with TypeError if priority_number in tuples of (priority_number, data) are the same.

2017-09-25 Thread R. David Murray
Changes by R. David Murray : -- nosy: +r.david.murray ___ Python tracker ___ ___

[issue31145] PriorityQueue.put() fails with TypeError if priority_number in tuples of (priority_number, data) are the same.

2017-09-24 Thread Nick Coghlan
Nick Coghlan added the comment: My rationale for asking "What if we just changed heapq back to working closer to the way it used to work?" is that it's a case where arbitrarily ordering unorderable tuples made sense, and reverting it to the old behaviour is reasonably safe: - some Py3 heapq

[issue31145] PriorityQueue.put() fails with TypeError if priority_number in tuples of (priority_number, data) are the same.

2017-09-24 Thread Raymond Hettinger
Raymond Hettinger added the comment: We already have recommendations in the heapq documentation on how to do a work-around. I'm looking at the more general problem of how can we make it easy once again to decorate a value with a sort value (not just for heaps but for anyplace where

[issue31145] PriorityQueue.put() fails with TypeError if priority_number in tuples of (priority_number, data) are the same.

2017-09-24 Thread Nick Coghlan
Nick Coghlan added the comment: The main downside I see to that approach is that it would still require quite a few client code changes to restore compatibility for folks upgrading from 2.7, and even though six could add a "six.Prioritize" backport, it would still be difficult for automated

[issue31145] PriorityQueue.put() fails with TypeError if priority_number in tuples of (priority_number, data) are the same.

2017-09-24 Thread Raymond Hettinger
Raymond Hettinger added the comment: Nick, what do you think about this proposal? The problem being solved is that decorated tuples no longer work well for controlling ordering (because so many types are now non-comparable). This provides a wrapper to control which fields are used in

[issue31145] PriorityQueue.put() fails with TypeError if priority_number in tuples of (priority_number, data) are the same.

2017-08-08 Thread Raymond Hettinger
Raymond Hettinger added the comment: I don't see any way to change PriorityQueue to fix this. The non-comparability of dicts likely won't be restored, nor will the lexicographic comparison order of tuples be likely to change. One possible way forward is to provide a wrapper with the desired

[issue31145] PriorityQueue.put() fails with TypeError if priority_number in tuples of (priority_number, data) are the same.

2017-08-08 Thread Mikołaj Babiak
New submission from Mikołaj Babiak: # list of tuples in form of (priority_number, data) bugged = [ (-25.691, {'feedback': 13, 'sentiment': 0.309, 'support_ticket': 5}), (-25.691, {'feedback': 11, 'sentiment': 0.309, 'support_ticket': 3}), (-25.0, {'feedback': 23, 'sentiment': 0.0,