On Tue, Oct 11, 2005 at 11:06:32AM -0700, [EMAIL PROTECTED] wrote: > Note that when I type: > >>>dir(D) [...] > the functions __ge__, __gt__, __lt__, __le__ seem to be non-implemented > but there is some __doc__ in them. Is there the intention to do > something similar as is described above or are they here for some > (future) dictionnary comparison purposes?
Sure they're implemented. That's why I can compare dictionaries for equality or order. >>> d = {1: None} >>> e = {1: None} >>> f = {2: None} >>> d == e True >>> d == f False >>> d < f or f < e True If the operation you need to optimize is "find the largest element that is smaller than X", then perhaps you want to use the bisect module. This involves keeping your information in a sorted list of tuples, instead of in a dictionary. However, removing or inserting items has O(n) complexity instead of O(1). Jeff
pgpoNBi46YeD2.pgp
Description: PGP signature
-- http://mail.python.org/mailman/listinfo/python-list