stack-like file object
Jp Calderone
exarkun at intarweb.us
Mon Jan 19 23:26:56 EST 2004
On Mon, Jan 19, 2004 at 06:43:14PM -0800, Josiah Carlson wrote:
> Rodrigo,
>
> > I need to implement a stack on a file.
> > The idea is to have a big list, and put part of his head on the disk. The
> > model of access to the file is like a stack (read in order only the tail,
> > write only at the tail).
> > How could I create this, knowing that I need to pickle arbritary objects ?
>
> While I don't condone the use of files as stacks, the below should work
> for you. It doesn't reduce in size when an object is removed, but as
> long as you don't try to share the stack between processes or threads,
> it should work fine.
condone
v : excuse, overlook, or make allowances for; be lenient with;
> [snip - file-based stack implementation]
Jp
More information about the Python-list
mailing list