On Feb 14, 12:31 pm, Stefan Behnel <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On Feb 14, 12:45 am, Stefan Behnel <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] wrote: > >>> Readability of the Pickle module. Can one export to XML, from cost of > >>> speed and size, to benefit of user-readability? > >> Regarding pickling to XML, lxml.objectify can do that: > > >>http://codespeak.net/lxml/objectify.html > > >> however: > > >>> It does something else: plus functions do not export their code, > >>> either in interpreter instructions, or source, or anything else; and > >>> classes do not export their dictionaries, just their names. But it > >>> does export in ASCII. > >>> Pickle checks any __safe_for_unpickling__ and __setstate__ methods, > >>> which enable a little encapsulating, but don't go far. > >> I'm having a hard time to understand what you are trying to achieve. Could > >> you > >> state that in a few words? That's usually better than asking for a way to > >> do X > >> with Y. Y (i.e. pickling in this case) might not be the right solution for > >> you. > > >> Stefan > > > The example isn't so bad. It's not clear that it isn't already too > > specific. Pickling isn't what I want. XML is persistent too. > > > XML could go a couple ways. You could export source, byte code, and > > type objects. (Pickle could do that too, thence the confusion > > originally.) > > What I meant was: please state what you are trying to do. What you describe > are the environmental conditions and possible solutions that you are thinking > of, but it doesn't tell me what problem you are actually trying to solve.
What problem -am- I trying to solve? Map the structure -in- to XML. > > gnosis.xml and lxml have slightly different outputs. What I'm going > > for has been approached a few different times a few different ways > > already. If all I want is an Excel-readable file, that's one end of > > the spectrum. If you want something more general, but still include > > Excel, that's one of many decisions to make. Ideas. > > > How does lxml export: b= B(); a.b= b; dumps( a )? > > > It looks like he can create the XML from the objects already. > > In lxml.objectify, the objects *are* the XML tree. It's all about objects > being bound to specific elements in the tree. > > Stefan- Hide quoted text - > > - Show quoted text - Objects first. Create. The use case is a simulated strategy tournament. -- http://mail.python.org/mailman/listinfo/python-list