plotly/python-api — pull request #103 by theengineear (2014-07-30 21:49:24+00:00)
Title: Use type() to create new classes and a factory to instantiate.

Some organizational changes. Previously, if you wanted to add a new trace say, TreeChart, you'd need to add it to graph_references, add a class definition in graph_objs.py, add multiple mappings in graph_objs.py and add it to a couple __all__ lists... which is a lot.

The reason we need to dynamically create classes is because we never know when graph_reference has changed! Therefore, we just do it at import time... Therefore, we were using metaclasses, but this is a little overkill, we can just pass a compiled `__doc__` to `type()` to make a class for us. The doc won't be changing after this, so it's not a problem afterwards.