def replace_types( me, **newtypes): '''uses newtypes (as valuedefs) instead. warn: to make optional( bool) into explicit 3-state textual, do not use optional( bool, aliaser( True:t1,False:t2,else:t3)).. needs optional( enum( t1:True,t2:False,t3:else)) ''' #assert not me.__dict__.get( '_methods_dict'), 'dont replace already used type, first inherit it' r = dictOrder() for w in me.methods_walk(): w = DictAttr( w.__dict__) w.decl = w.decl.clone_new_types( types= newtypes) r[ w.name] = w me._methods_dict = r