[Spambayes] Current version

Moore, Paul Paul.Moore@atosorigin.com
Mon Nov 25 16:58:51 2002

From: Neale Pickett [mailto:neale@woozle.org]
> Ya know, now that I think about it, we don't need key
> iteration anymore.  Since we're now storing only the
> counters associated with a word, there's no reason I
> can think of that anything would need to iterate over
> the keys.
> Instead of going back to dbhash, I'm going to see if we
> can't dump dbdict altogether and just use the built-in
> shelve module.

I'd rather you didn't. I can't (immediately) see a simple way
to customize shelve to use (say) pybsddb. Let me have a play
tonight, and I'll see if I can make it customizable as it

I'm assuming from what you say that I can simply rip out
the __iter__ and iter* methods? In fact, if so, it's pretty
simple. Just change "import anydbm" to

    from Options import options
    # Whatever name seems appropriate - the default
    # value should be 'anydbm'
    DBM_METHOD = options.dbm_implementation_method
    dbm = __import__(DBM_METHOD)

and then use dbm in place of anydbm.

For pybsddb, we may need an adapter class to supply the
right set of methods, but that's not hard, and then it's
just a case of


in bayescustomize.ini if the user wants to go this way.


PS Just in case it's getting lost why I care about this - if
   my speculation about the hangs I've been getting is correct,
   and it's related to the old and buggy DBM implementation
   supplied as standard in the Windows distribution, this could
   hit a lot of Windows users. Making sure we can work around
   it is probably worth it. Totally automatic detection of
   whether pybsddb is installed would be even more idiot-proof,
   but let's walk before we run - after all, we may end up
   all using Zodb in any case :-)

More information about the Spambayes mailing list