[Dieter Maurer]
> 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,
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.
[Dieter Maurer]
> The current Python falls back to order by type name and than by id.
Except that in current CPython releases, None is an exception to that, like
>>> class C(object):
... pass
>>> c = C()
>>> None < c # None is less than c
True
>>> type(None).__name__ < type(c).__name__ # alt
Jim Fulton wrote at 2005-7-7 06:55 -0400:
> ...
[Martijn]
>> The following sequence I think leads to trouble:
>>
>>
>> value = getattr(object, self.field_name, None)
>> if value is None:
>> return None
>>
>> as this means attributes that do exist and have the value No
[Jim Fulton]
|> ...
> AFAICT, Python still makes no guarantee wrt comparison of
> of objects of different types over time:
That's true, and in particular the relative (wrt objects of non-None
types) ordering of None _has_ changed across CPython releases.
The "Total Ordering and Persistence" secti
Martijn Faassen wrote:
Jim Fulton wrote:
[snip]
It would only be safe to use None as a BTree key if all of the keys used
were None, which wouldn't be very interesting. :)
It'd also make sense if you didn't do a range query, right? I.e. you're
just looking for (None, None). I realize though
Jim Fulton wrote:
[snip]
It would only be safe to use None as a BTree key if all of the keys used
were None, which wouldn't be very interesting. :)
It'd also make sense if you didn't do a range query, right? I.e. you're
just looking for (None, None). I realize though that queries with None
do
Martijn Faassen wrote:
Hi there,
in zope.app.catalog.attribute, there's the following functionality:
def index_doc(self, docid, object):
if self.interface is not None:
object = self.interface(object, None)
if object is None:
return None