[Zope-ZEO] Need for PersistentList

John D. Heintz jheintz@isogen.com
Fri, 19 Jan 2001 13:57:07 -0600


Did you see the example script that I send to the list this morning?  It 
seems to indicate that Persistent objects are persistently hashable if 
they have a __hash__() method and it seemed to work accross db 
connections regardless of what that method returned!

The usage I am after is being able to index from Persistent keys to 
something.  I understand that hashing off the _p_oid is the first 
intuitive way to do it, and also that it wouldn't work on newly created 
objects.  Strangely though, this seems to be exactly what is working in 
my sample script????

Confused,
John

Jim Fulton wrote:

> Andrew Kuchling wrote:
> 
>> On Thu, Jan 18, 2001 at 04:35:37PM -0600, John D. Heintz wrote:
>> 
>>> Finally, we need for Persistent classes to be hashable.
>> 
>> Hmm... Does __hash__() not work on an ExtensionClass? 
> 
> 
> It works fine for me. I just implemented a hash method on
> a Persistent class and verified that it gets called.
> 
> I also verified that if I don't implement __hash__, I get an
> error, which I submit is a bonus, since it would be really 
> bad for persistent objects to get accidentilly stored in a 
> persistent hash table using their address.  
> 
> I guess it would be desireable for the default hash for a 
> persistent object to be based on it's persistent id, but that
> would noty work for objects whos persistent id hasn't been set.
> It also breaks an unwritten rule that object ids should not be
> used at the application level.  Hm. 
> 
> Jim
> 
> 
> --
> Jim Fulton           mailto:jim@digicool.com   Python Powered!        
> Technical Director   (888) 344-4332            http://www.python.org  
> Digital Creations    http://www.digicool.com   http://www.zope.org
> 
> _______________________________________________
> Bug reports, feature requests, etc. go in the ZEO Tracker:
> http://www.zope.org/Products/ZEO/Tracker
> 
> Conversations etc. can take place in the Wiki:
> http://www.zope.org/Products/ZEO/Wiki
> 
> Zope-ZEO maillist  -  Zope-ZEO@zope.org
> http://lists.zope.org/mailman/listinfo/zope-zeo



-- 
. . . . . . . . . . . . . . . . . . . . . . . .

John D. Heintz | Senior Engineer

1016 La Posada Dr. | Suite 240 | Austin TX 78752
T 512.633.1198 | jheintz@isogen.com

w w w . d a t a c h a n n e l . c o m