From: kj on



I'm looking for a module that implements "persistent lists": objects
that behave like lists except that all their elements are stored
on disk. IOW, the equivalent of "shelves", but for lists rather
than a dictionaries.

Does anyone know of such a module?

(I suppose that I could slap together a crude implementation of
such a thing by wrapping a shelf with suitable methods to simulate
the list interface. But I'd rather not roll my own if a tested
implementation already exist.)

TIA!

~K
From: Thomas Jollans on
On Tuesday 10 August 2010, it occurred to kj to exclaim:
> I'm looking for a module that implements "persistent lists": objects
> that behave like lists except that all their elements are stored
> on disk. IOW, the equivalent of "shelves", but for lists rather
> than a dictionaries.
>
> Does anyone know of such a module?
>
> (I suppose that I could slap together a crude implementation of
> such a thing by wrapping a shelf with suitable methods to simulate
> the list interface. But I'd rather not roll my own if a tested
> implementation already exist.)

You could simply use pickle to save the data every once in a while.
From: Raymond Hettinger on
On Aug 12, 1:37 pm, Thomas Jollans <tho...(a)jollybox.de> wrote:
> On Tuesday 10 August 2010, it occurred to kj to exclaim:
>
> > I'm looking for a module that implements "persistent lists": objects
> > that behave like lists except that all their elements are stored
> > on disk.  IOW, the equivalent of "shelves", but for lists rather
> > than a dictionaries.
. . .
> You could simply use pickle to save the data every once in a while.

That is a very reasonable solution.