How can I create instance of a namedtuple dynamically? is it possible?
Msg = collections.namedtuple('Msg', 'a b c')
...
mymsg = Msg(a=1,b=2,c=3)
msg_as_dict = mymsg._as_dict()
msg['recover_name'] = type(mymsg).__name__
How can I create Msg instance back from msg['recover_name']
on runtime?
Aucun commentaire:
Enregistrer un commentaire