Re: persistent deque (continued)

2008-07-26 Thread castironpi
On Jul 21, 5:20 pm, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > On Jul 21, 12:08 pm, castironpi <[EMAIL PROTECTED]> wrote: > > > Some time ago, I was asking about the feasibility of a persistent > > deque, a double-ended queue. > > > It runs into the typic

Re: persistent deque (continued)

2008-07-21 Thread Raymond Hettinger
On Jul 21, 12:08 pm, castironpi <[EMAIL PROTECTED]> wrote: > Some time ago, I was asking about the feasibility of a persistent > deque, a double-ended queue. > > It runs into the typical space allocation problems.   Try starting with a dict-based implementation of a double-

Re: persistent deque (continued)

2008-07-21 Thread M.-A. Lemburg
On 2008-07-21 21:08, castironpi wrote: Some time ago, I was asking about the feasibility of a persistent deque, a double-ended queue. You might want to have a look at mxBeeBase: http://www.egenix.com/products/python/mxBase/mxBeeBase/ Using the integer index you could probably write an on

Re: persistent deque (continued)

2008-07-21 Thread Larry Bates
castironpi wrote: Some time ago, I was asking about the feasibility of a persistent deque, a double-ended queue. It runs into the typical space allocation problems. If you're storing a pickle, you have to allocate and fragment the file you've opened, since pickles can be varia

persistent deque (continued)

2008-07-21 Thread castironpi
Some time ago, I was asking about the feasibility of a persistent deque, a double-ended queue. It runs into the typical space allocation problems. If you're storing a pickle, you have to allocate and fragment the file you've opened, since pickles can be variable-length strings; i.e.

Re: persistent deque version 4

2008-05-24 Thread Gabriel Genellina
En Thu, 22 May 2008 12:20:56 -0300, inhahe <[EMAIL PROTECTED]> escribió: > I thought about the fact that a decorator is merely syntactic sugar, so it > shouldn't have any closure magic that I can't make myself, and I realized > that I could have done it the following way: > > def makefunc(func): >

Re: persistent deque version 4

2008-05-22 Thread inhahe
"inhahe" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > 4. can someone tell me if the way i'm using the decorator is sane? i've > never used decorators before. it just seems ridiculous to a) define a > lambda that just throws away the parameter, and b) define a meaningless >

Re: persistent deque

2008-05-21 Thread inhahe
something randomly made me realize why my second solution didn't work, so i fixed it. now you have a working persistent deque. 1. if you call somepdequeobject.load(filename) (as opposed to pdeque.load(filename)), do you want it to return a new object that it loaded from file, or do you

Re: persistent deque

2008-05-20 Thread inhahe
> > i don't know how i would get around the problem, though, because i'd have > to know how to access the deque object that my class stores when i do > deque.__init__ in my constructor, so that i could pickle it and my class > variables separately. > > i decided i could just pickle deque(self),

Re: persistent deque

2008-05-20 Thread inhahe
oh yeah! thanks for pointing it out, i should have thought of that, i *just* read about it today, or was it yesterday. so what's the problem with pickle? i have a feeling, maybe i read it, that when you pickle a derived class it pickles it as a member of the base class, is that it? i don't k

Re: persistent deque

2008-05-20 Thread Larry Bates
inhahe wrote: def __init__(self, filename, initial): should be def __init__(self, filename, initial=[]): (that was the whole reason i put the filename first.) sorry. Defaulting initial to empty list this way is asking for trouble. You should default it to None and check for None and

Re: persistent deque

2008-05-20 Thread inhahe
def __init__(self, filename, initial): should be def __init__(self, filename, initial=[]): (that was the whole reason i put the filename first.) sorry. -- http://mail.python.org/mailman/listinfo/python-list

Re: persistent deque

2008-05-20 Thread inhahe
"castironpi" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'd like a persistent deque, such that the instance operations all > commit atomicly to file system. ok, i made your persistent deque. but there are two important notes regarding this module

persistent deque

2008-05-20 Thread castironpi
I'd like a persistent deque, such that the instance operations all commit atomicly to file system. -- http://mail.python.org/mailman/listinfo/python-list