Suppose I create a complex set of types:
def subordinate_type(params):
a = type(myname, (), dict_of_fields)
return a()
def toplevel(params)
lots_of_types = dict(keys, values)
myawesomedynamictype = type(toplevelname, (), lots_of_types)
return myawesomedynamictype()
In this particular case, I want a link to the "typeclass" myawesomedynamictypeinserted in lots_of_types.
I tried iterating through lots_of_typesand setting it, assuming the links were pointing to the same thing, but I found that I myawesomedynamictypegot damaged and lost my fields.
The problem I'm trying to solve is that I am getting values that are type specific subordinate_typeand I need to generate an instance toplevelbased on subordinate_type.
source
share