On Fri, Sep 24, 2010 at 9:27 AM, Shane Hathaway <sh...@hathawaymix.org> wrote:
> On 09/24/2010 07:03 AM, Jim Fulton wrote:
>>
>> On Fri, Sep 24, 2010 at 4:17 AM, César Muñoz<xcum...@gmail.com>  wrote:
>>>
>>> Hello Marius,
>>>
>>> thank you so much for your quick answer! I'll give it a try implementing
>>> these methods and will get back to you with the result.
>>> But anyway, the Chatroom class is inheriting from Persistent, I thought
>>> this
>>> base class provided some basic comparison methods...
>>
>> It does.  That's the problem. It would be better if it didn't and
>> insertion failed.  The methods it provides are inherited from object
>> and compare based on object address, which completely inappropriate
>> for persistent objects.
>
> +1, FWIW.

I wasn't proposing to change anything. :) Breaking inheritance to avoid
inheriting a bad cmp seems rather too tricky.  (I assume there isn't
a default comparison in Python 3, although I haven't checked.)

I suppose that the BTree implementation could check for object's
bad comparison operator and fail if it sees it. (Details omitted. :)

This obviously wouldn't happen in 3.10, but might be a fun project for
someone in 3.11.

Jim

-- 
Jim Fulton
_______________________________________________
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zodb-dev

Reply via email to