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 the case for many callables).
>>> tasks = [(10, lambda: 0), (20, lambda: 1), (10, lambda: 2)]
>>> tasks.sort()
Traceback (most recent call last):
...
TypeError: unorderable types: function() < function()
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
Raymond
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com