Re: dumping in destructor

2008-10-21 Thread Митя
ot;Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Mon, 20 Oct 2008 10:01:07 -0200, Митя <[EMAIL PROTECTED]> escribió: > > > Thank you for your answers! > > > my g_register is a global object, and it lives all the program's > > lifetime, so 'with&

Re: dumping in destructor

2008-10-20 Thread Митя
Thank you for your answers! my g_register is a global object, and it lives all the program's lifetime, so 'with' is not appliable. Am I right? I tried to use atexit and wrote following: class _Register(object): def dump(self): class Registerable(object): g_register = _

Re: dumping in destructor

2008-10-20 Thread Митя
Thanks for your answers! my g_register is a global register, wich contains all my objects and lives all the program lifetime. So 'with' is not appliable. Am I right? But using atexit sounds to be a good solution On Oct 20, 1:58 pm, Michele Simionato <[EMAIL PROTECTED]> wrote: > On Oct 20, 10:12š

dumping in destructor

2008-10-20 Thread Митя
I have a class which I want to save it's data automatically on disc, when it's destroyed. I have following code: from cPickle import dump class __Register(object): def __init__(self): self.dict = {} def __del__(self): fh = open('aaa', 'w') dump(self.dict, fh)

properties access by name

2008-10-17 Thread Митя
I use rwproperty (http://pypi.python.org/pypi/rwproperty/1.0) and so I have properties in my class. Also I have a list of names of properties wich I am to set. How can I access my properties by name in such way that when I want to set a property, setter will be called, and and when I want to read i