Make and control Python objects from JSON or YAML files
We want to construct a hierarchical collection of Python objects from a data file.
Three types of data:
- simple - strings, lists, dictionaries, booleans,
- class - represents a Python class that gets constructed
- container class - a Python class that contains other class data within it
Class data corresponds to a Python constructor.
Classes have attributes - either read-only (set in the constructor) or read-write.
A Class always has a
We walk the tree-depth first.
There are potential customization points at five places.
These ones will be class methods
- pre_construction - rewrite the dictionary
- at construction - before any child is created or public attribute is set.
-- after this, we're an object
- post-attribute - after all the attributes have been set
- post-child - after all children are created
- post-parent - after your parent has created all your siblings
- ready - right before we're ready to start