Does anyone have any ideas about what to do with issue 5830 and handling the
problem in a general way (not just for sched)?
The basic problem is that decorate/compare/undecorate patterns no longer work when the primary sort keys are equal and the secondary
keys are unorderable (which is now
Raymond Hettinger python at rcn.com writes:
Would it make sense to provide a default ordering whenever the types are
the same?
This doesn't work when they are not the same :-)
Instead, you could make the decorating a bit more sophisticated:
decorated = [(key, id(value), value) for key,
Would it make sense to provide a default ordering whenever the types are
the same?
This doesn't work when they are not the same :-)
_ ~
@ @
\_/
Instead, you could make the decorating a bit more sophisticated:
decorated = [(key, id(value), value) for key, value in blah(values)]
or
Raymond Hettinger wrote:
Would it make sense to provide a default ordering whenever the types are
the same?
def object.__lt__(self, other):
if type(self) == type(other):
return id(self) id(other)
raise TypeError
No. This only makes it more
I'm wondering if there is something we can do to mitigate
the issue in a general way. It bites that the venerable technique
of tuple sorting has lost some of its mojo. This may be
an unintended consequence of eliminating default comparisons.
I would discourage use of the
Raymond Hettinger wrote:
The problem is that a basic python pattern is now broken
in a way that may not readily surface during testing.
I'm wondering if there is something we can do to mitigate
the issue in a general way. It bites that the venerable technique
of tuple sorting has lost some
On Fri, Apr 24, 2009, Raymond Hettinger wrote:
I'm wondering if there is something we can do to mitigate the issue in
a general way. It bites that the venerable technique of tuple sorting
has lost some of its mojo. This may be an unintended consequence of
eliminating default comparisons.
Raymond Hettinger wrote:
Does anyone have any ideas about what to do with issue 5830 and handling
the problem in a general way (not just for sched)?
The basic problem is that decorate/compare/undecorate patterns no longer
work when the primary sort keys are equal and the secondary keys are
I would discourage use of the decorate/sort/undecorate pattern,
and encourage use of the key= argument. Or, if you really need
to decorate into a tuple, still pass a key= argument.
The bug report was actually about the sched module which used
heapq to prioritize tuples consisting of times,
Raymond Hettinger wrote:
I would discourage use of the decorate/sort/undecorate pattern,
and encourage use of the key= argument. Or, if you really need
to decorate into a tuple, still pass a key= argument.
The bug report was actually about the sched module which used
heapq to prioritize
10 matches
Mail list logo