persistent deque

inhahe inhahe at gmail.com
Tue May 20 23:07:03 EDT 2008


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 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.




"Larry Bates" <larry.bates at websafe.com`> wrote in message 
news:0uednUCD-McN-a7VnZ2dnUVZ_tzinZ2d at comcast.com...
> 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 reset to empty list.
>
> -Larry 





More information about the Python-list mailing list