[issue3908] Strange heapq behavior on Python 3.0 when overriding __le__

2008-09-19 Thread Giampaolo Rodola'
Giampaolo Rodola' <[EMAIL PROTECTED]> added the comment: Ok, thanks for the hints. ___ Python tracker <[EMAIL PROTECTED]> ___ ___ Python-bugs-lis

[issue3908] Strange heapq behavior on Python 3.0 when overriding __le__

2008-09-19 Thread Raymond Hettinger
Raymond Hettinger <[EMAIL PROTECTED]> added the comment: It's supposed to be that way. In 2.6 we support both to help with transition. In 3.0, we've cleaned up and made the APIs consistent. Try to get in the habit of defining all six rich comparisons to bulletproof code and not rely on undocu

[issue3908] Strange heapq behavior on Python 3.0 when overriding __le__

2008-09-19 Thread Sascha Müller
Changes by Sascha Müller <[EMAIL PROTECTED]>: -- nosy: +giampaolo.rodola ___ Python tracker <[EMAIL PROTECTED]> ___ ___ Python-bugs-list

[issue3908] Strange heapq behavior on Python 3.0 when overriding __le__

2008-09-19 Thread Sascha Müller
Sascha Müller <[EMAIL PROTECTED]> added the comment: heapq expects a _lt_ method, and the error doesn't occur when the _le_ method is changed to _lt. According to the SVN log, this was changed due to consistency with lists.sort(). -- nosy: +einmaliger -giampaolo.rodola _

[issue3908] Strange heapq behavior on Python 3.0 when overriding __le__

2008-09-19 Thread Giampaolo Rodola'
New submission from Giampaolo Rodola' <[EMAIL PROTECTED]>: import heapq class foo: def __init__(self): self.timeout = 0 def __le__(self, other): return self.timeout <= other.timeout heap = [] heapq.heappush(heap, foo()) heapq.heappush(heap, foo()) This code on Python 2