Archived

This forum has been archived. Please start a new discussion on GitHub.

Accessing complete type info in Python

I want to store instances of user defined types using JSON or XML. Is there any canonical way to do so in Python?
My original idea was to write a generic un-/marshaller, but information about types of sequence elements gets lost in the Python-Slice mapping, so I don't see a way to write a generic unmarshaller. Is there a way to find out the type of sequence elements without having a nonempty instance of the sequence at hand? A parsed representation of the slice definitions would probably do.

Comments

  • mes
    mes California
    Hi,

    The Ice extension for Python maintains an internal representation of the Slice definitions, but doesn't expose this information to Python code.

    Another Ice user has written a Slice-to-XML translator. You could generate XML from your Slice definitions and then use it to drive your marshaling activities.

    Regards,
    Mark