Charles-François Natali <[email protected]> added the comment:
> A dict can contain non-orderable keys, I don't know how an AVL tree
> can fit into that.
They may be non-orderable, but since they are required to be hashable,
I guess one can build an comparison function with the following:
def cmp(x, y):
if x == y:
return 0
elif hash(x) <= hash(y):
return -1
else:
return 1
It doesn't yield a mathematical order because it lacks the
anti-symmetry property, but it should be enough for a binary search
tree.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue13703>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com