On Thu, Aug 5, 2010 at 10:59 AM, Phil Thompson <p...@riverbankcomputing.com> wrote: > On Thu, 5 Aug 2010 10:13:27 -0400, Darren Dale <dsdal...@gmail.com> wrote:
[...] >> Is there any documentation available on dynamically creating a new model >> type? > > You do it just like you would for any other Python type by calling its > meta-type... > > from dip.model import MetaModel, Model, Int > > my_dynamic_type = MetaModel('MyDynamicType', (Model, ), > dict(my_int_attr=Int)) > > my_instance = my_dynamic_type(my_int_attr=10) > > # This will raise an exception... > my_instance.my_int_attr = 'bad' > > You will have to use the current dip snapshot as I hadn't exposed > MetaModel as part of the dip.model in v0.1. Great, thank you! _______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt