XML/Source Persistence (was: Source formatting for long expressions.)

Michael Gilfix mgilfix at eecs.tufts.edu
Tue Jun 11 14:26:03 EDT 2002


On Tue, Jun 11 @ 13:55, Christopher Armstrong wrote:
> I meant the mappings that attributes provide. Creating mappings with multiple
> tags is overbearingly verbose, no matter if you formalize it or not. (Am I
> understanding you correctly?) Perhaps I should've said "flexible" rather
> than "robust". BTW, ONX (http://www.seairth.com/web/onx/onx.html) provides
> a better type of mapping: string:arbitrary object. It's not
> arbitrary object:arbitrary object, but it's a bit better.

  I agree that's very verbose and cumbersome. That's why I supported your
non-use of XML. ONX is interesting though. Gonna have to take a closer look.

> Versioning the persistent data is pretty much irrelevant wrt the format used --
> and yes, I have thought about it. Marmalade right now uses it's own versioned
> state-getters/setters (jellyToDOM_X where X is the version number), but AOT
> doesn't have its own interface -- it just uses __getstate__/__setstate__ like
> pickle. I'm probably going to write a mixin class for versioned state that
> supports methods like __getstate_X__ where X is the version of the persisted 
> state.

  If anything, I think that's where the XML format is nice - in versioning.
Usually, you get to do considerably more code-sharing with XML formats and
the update functions are very simplistic.

> Note that Twisted has a class for versioning state that's orthogonal to
> persisted format: twisted.persisted.styles.Versioned. This allows you
> to define 'upgradeToVersionX' methods that will be called in order to
> upgrade an object to the current version of the code. The only reason
> to use versioned state getters/setters as opposed to this is if you want
> the format of the persistent state to change for cosmectic reasons.

  This sounds prety cool. Will have to check it out.

                     -- Mike

-- 
Michael Gilfix
mgilfix at eecs.tufts.edu

For my gpg public key:
http://www.eecs.tufts.edu/~mgilfix/contact.html





More information about the Python-list mailing list