Databases and python
Rene Pijlman
reply.in.the.newsgroup at my.address.is.invalid
Fri Feb 17 15:22:14 EST 2006
Dan Stromberg:
>Rene Pijlman:
>> Right. My second attempt would be: a BTree with the word as key, and a
>> BTree of filenames as value
>Would ZODB let me do that?
Yes.
>I'm puzzled, because:
>>>> d1={}
>>>> d={}
>>>> d[d1] = ''
>TypeError: dict objects are unhashable
This is using a dict as _key_, whereas I suggested to use a BTree as
_value_.
>I don't know how to do a btree of btrees in python...
Read this first:
http://www.zope.org/Wikis/ZODB/guide/node6.html#SECTION000630000000000000000
On second thought, a BTree of TreeSet's may be a better idea.
The key of your outer BTree is a word. It's value is a TreeSet. The key of
that TreeSet is a filename. It has no values.
This provides you with a persistent scalable mapping:
word -> set of filenames
I estimate it takes 2 hours to learn ZODB, and 20 minutes to program a
benchmark. The hours are reusable :-)
--
René Pijlman
More information about the Python-list
mailing list