Chris Withers wrote: > Hanno Schlichting wrote: >> Nope. DateTime objects are plain old-style classes and don't inherit >> from persistent.*. > > Hmm, oh well, my bad... > In that case it must just be that their pickled form is huge compared to > an int ;-)
Sure: len(cPickle.dumps(DateTime.DateTime(), 1)) == 392 Where as their float representation is: len(cPickle.dumps(DateTime.DateTime().timeTime(), 1)) == 10 > They are incredibly expensive to unpickle since all >> the DWIM magic in their __init__ get called each time, though. > > How come? Unpickling doesn't call __init__ and I don't see why the DWIM > magic would be needed anyway, since everything has already been parsed. How would a new instance of a class be constructed without calling the init or new? Look at the _instantiate method in pickle.py, when it does: value = klass(*args) What happens on unpickling is that a new DateTime instance representing "just now" is generated and then that instance is updated with the values from the pickle. Hanno _______________________________________________ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@zope.org http://mail.zope.org/mailman/listinfo/zodb-dev