ZODB: don't like self._p_changed

Terry Reedy tjreedy at udel.edu
Thu Jan 9 10:51:21 EST 2003


"Thomas Guettler" <zopestoller at thomas-guettler.de> wrote in message
news:avjrhb$heh$04$1 at news.t-online.com...
> 2. Solution:
> Change the functions of list and mapping datatypes to set _p_changed
if
> the content was changed. This might decrease performance for
> nonpersistent application. But since there changes need to be
> implemented in the python core, they would be in C.

Lists and dicts are general purpose types.  The flag self._p_changed
(you left off the crucial 'self' part above) is specific to ZODB and
usually does not exist.  Even when it does, standard append does not
know what 'self' is in the context in which it is called, and could
not change it anyway.  So, for special purpose behavior, you must do
something special: set the flag yourself, use a special (derived)
type, or write a special method for your class such as

    def append(self, val):
        self.mylist.append(val)
        self._p_changed = 1

Terry J. Reedy






More information about the Python-list mailing list