In the following code either I am using dictionaries wrong or I'm
missing something with ExtensionClass in general.  Can someone explain
the best way for me to map from one instance to another?

I have tried searching Zope and Python mailing lists and resources for
an answer to this question but have become confused by different
conflicting messages.  On the one hand I have heard that dictionary keys
are supposed to be immutable.  On the other, I've heard that
dictionaries are used to simulate (key is object, value is ignored) some
aspects of sets.  Which is correct?  

What I really want is to be able to map a Persistent object to a string.

Thanks for any help.
John Heintz


import ZODB
from Persistence import Persistent

class Test1:
    pass

class Test2(Persistent):
    pass

dict = {}
t1 = Test1()
t2 = Test2()

try:
    dict[t1] = 1
except:
    print "Using instance of Test1 as key failed!"

try:
    dict[t2] = 2
except:
    print "Using instance of Test2(Persistent) as key failed!"


-- 
John D. Heintz
DataChannel, Inc.
Senior Engineer
512-633-1198
[EMAIL PROTECTED]

_______________________________________________
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to