Why isn Python introspection used for XML serialization?
Fundamentally there are two approaches one could take to provide XML serialization of objects: 1. The object is unaware of how it might be serialized, instead via introspection and recursion objects are broken down into fundamental types with simple rules on how to encode each fundamental type in XML. 2. The object is XML aware and is in control of exactly what its XML representation is. Option 1 is simple and elegant. Unfortunately it’s not robust. There is no way to control what the final XML representation will be, anything in the object will get serialized, even if its not meant to be part of its portable representation. Python is very forgiving and you can attach any data you want at any time by simply assigning to the object. Such “extra data” might be legitimate internal private use, or it might get attached to the object by programmer error. Either way, it’s not data which should get serialized into its portable representation. The portable representation should be very well de