[spambayes-dev] dump db version in db['saved state']?
Tim Peters
tim.one at comcast.net
Sat Sep 27 22:37:45 EDT 2003
[Skip]
> I've been messing around a lot manipulating training databases. I
> always wind up special-casing db["saved state"] because it's a
> three-element tuple (version, spamcount, hamcount), while all the
> token keys are two-element tuples.
>
> Has the version ever changed?
Sure -- the original WordInfo saved gads more info (like last access time).
The *intent* of the version number has always been ignored, though: it's
there so that future code can reliably recognize that a database it's
reading is an old one, and auto-convert it to the current version. Instead,
code so far has simply barfed if it sees a version number it doesn't like.
> Do we expect it to change?
It's good defensive practice to expect change.
> If not, can we get rid of it? That way, anything which loops over a
> database won't need to worry about the 'saved state' key, at least
> not nearly as often.
How freakin' lazy can you get <wink>? A database should record its own
version number. There's no particular reason it got saved in a 3-tuple
mixed in with other stuff, though. If you think life is going to get
clarified if the database stored only 2-tuples, then, for example, bump the
version number again, store a 2-tuple containing the version number, and a
distinct 2-tuple storing the #s of ham and spam trained on.
More information about the spambayes-dev
mailing list