Tim Peters wrote at 2005-7-7 15:03 -0400: > ... [Dieter] >> However, there is an additional reason not to put "None" into a BTree. >> >> Its interface has a weekness in its "keys", "values", "min" and "max" >> methods. >> >> E.g. in "keys(min,max)", "min=None" or "max=None" mean: no restriction. >> >> Therefore, they cannot distinguish between a "None" stored in the >> BTree itself and the use of "None" as "no restriction".
[Tim] >Yup, except I wouldn't call it a weakness. Since BTrees should not be >used with mixed key types anyway, and None is only value of type >type(None), the only BTrees having None as a key should be empty or >contain a single key (namely, None). Range search on trees with 0 or >1 elements isn't particularly difficult <wink>. Restrictions are fine when they are either * enforced (I know BTrees do not enforce the "no mixed key types" restriction) * clearly documented I do not know whether the ZODB 3.4 BTrees interfaces document the restriction (this would be a good place, I think) Hopefully, they do ;-) -- Dieter _______________________________________________ Zope3-dev mailing list Zope3firstname.lastname@example.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com