On Tue, Sep 27, 2011 at 6:16 AM, 刘一新 <liuy...@gmail.com> wrote:
> Hi. I Use eye to browse the ZODB database. There, the methods of the float
> object or any normal class objects are also shown. Are these methods stored
> in the database?

Generally speaking, clases and methods are not stored in the database,
only class names. (It's possible to store special class
implementations in the database, but this is extremely advanced and
never done.

> Besides doing the _p_change magic, is there any extra advantage to write
> class derived from persistent.Persistent? Does ZODB store the
> persistent.Persistent subclass object more efficiently (much faster? smaller
> size?)

Persistent objects must derive from Persistent. Objects that don't
subclass Persistent:

- Do not get their own database records.

- Are stored by value, rather than by reference. So if, in your
  application, two persistet objects refer to the same non-persistent
  object, after being stored and reloaded, they non-persistent object
  will be duplicated and unshared.


Jim Fulton
For more information about ZODB, see the ZODB Wiki:

ZODB-Dev mailing list  -  ZODB-Dev@zope.org

Reply via email to