Hello, Is there a good/standard way of having (composite) objects write a Python script which will regenerate the very same object ?
This problem arises when I construct, for example, a "ComputationalProblem" object, possibly through an object editor GUI, importing data structures from external geometric and material modelers etc. Once the object has been constructed, one wants to write it to a file on disk, for example to do the computations later on. In order to help users, familiar with the (in)famous "input-file monolithic-code output-file" sequence I would like to have this diskfile take the form of recognisable and editable Python code (instead of a "dump" solution with Pickle for example). I think there are problems with uniqueness and ordering of the component instantiations. I was thinking of something like a depth-first recursive write-script() on the object's attributes using the __class__ 's to construct generic names for the instantiations. Has anyone given this a thought already ? Thank you in advance for any remarks, -- Bas Michielsen ONERA, Electromagnetics and Radar Department 2, avenue Edouard Belin, 31055 TOULOUSE cedex, France Tel. (++33)(0)5 62 25 26 77 Fax. (++33)(0)5 62 25 25 77 -- http://mail.python.org/mailman/listinfo/python-list