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.x works without problems, by using Python3.0-RC1
it raises the following exception:


    heapq.heappush(heap, foo())
TypeError: unorderable types: foo() < foo()


Note that the previous 3.0 beta didn't have such problem.

----------
components: Library (Lib)
messages: 73425
nosy: giampaolo.rodola
severity: normal
status: open
title: Strange heapq behavior on Python 3.0 when overriding __le__
versions: Python 3.0

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3908>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to