[ZODB-Dev] persisting "immutable" classes

John Belmonte john at neggie.net
Thu Feb 26 17:32:17 EST 2004


I've caught myself a few times storing class instances in the database 
which are not derived from Persistent.  If I never mutate the instance's 
attributes once it is stored, is it wrong to do so?

Related to this, I found that classes derived from Persistent handle 
slots correctly, while if I didn't derive from Persistent I'd have to 
define my own get/setstate.  So, assuming not deriving from Persistent 
is an option, this prompts the lazy person's question:

   Given an equal number of attributes, what consumes less resources: a
   class derived from Persistent with slots, or a class not derived from
   Persistent without slots?

-John


-- 
http:// if  ile.org/



More information about the ZODB-Dev mailing list