[issue31145] PriorityQueue.put() fails with TypeError if priority_number in tuples of (priority_number, data) are the same.
Raymond Hettinger
report at bugs.python.org
Tue Dec 5 02:08:15 EST 2017
Raymond Hettinger <raymond.hettinger at gmail.com> 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: Any=field(compare=False)
def f(): pass
def g(): pass
print(sorted([KeyedItem(10, f), KeyedItem(5, g)]))
I'm thinking of just making an example in the docs and closing this out.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31145>
_______________________________________
More information about the Python-bugs-list
mailing list