[ZODB-Dev] Default comparison considered harmful in BTrees.
Jim Fulton
jim at zope.com
Wed Oct 27 09:58:07 EDT 2010
On Wed, Oct 27, 2010 at 9:17 AM, Hanno Schlichting <hanno at hannosch.eu> wrote:
> On Mon, Oct 25, 2010 at 11:51 PM, Jim Fulton <jim at zope.com> wrote:
>> I'm inclined to treat the use of the comparison operator inherited
>> from object in BTrees to be a bug. I plan to fix this on the
>> trunk.
>
> Did you mean to throw warnings for simple built-in types?
No.
> I'm now getting warnings for simple strings and ints, I'd expect
> tuples as well.
That's odd. I'm not. What platform and Python version?
Can you give some examples?
> All of these do inherit from object and use the
> default __cmp__.
I'm not sure what you mean by "these", but strings, int,
and tuples certainly don't use the default comparison. If they
did, sorting on them would be useless.
> But their hash implementation used in the default
> __cmp__ should be safe to use.
Strings, ints and tuples don't use hash for comparison.
Jim
--
Jim Fulton
More information about the ZODB-Dev
mailing list