Olivier Dormond ha escrito: > > xxx = new.instance(MyClass, {'a':1,'b':2,'done':1}) > > > > In other words, I need a *string* which, being sent to eval(), would > > return the original object state saved in the pickle. > > Doesn't pickle.loads just do what you need ? e.g.: > > >>> pickled = file('test.dat', 'rb').read() > >>> obj = eval('pickle.loads(%r)'%pickled) > >>> obj > <__main__.MyClass instance at 0xb7bfb76c> > >>> obj.a, obj.b, obj.done > (1, 2, 1)
Er... Touché :) - What year did World War II finish? - Same year the Potsdam Conference was held. - When was that? - The year World War II finished. I should have stated that I need an *explicit* string... Gabriel Genellina Softlab SRL -- http://mail.python.org/mailman/listinfo/python-list