Tim Peters wrote at 2005-7-7 15:03 -0400:
> ...
>> 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".

>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"

  *  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 ;-)

Zope3-dev mailing list
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to