2024-04-25 18:17:07 发布
网友
像这样的事情:
class Reference (object): pass new_type = type ('{0}_refrence'.format (type (instance).__name__), (type (instance), Reference), {}) new_instance = new_type (instance)
我想让实例从引用中派生出来,但表现得像往常一样。。。 有可能吗? 提前谢谢!你知道吗
如果我明白你想做什么。。。你知道吗
class Reference(object): pass instance = 2 new_type = type('{0}_reference'.format(instance.__class__.__name__), (instance.__class__, Reference), {}) new_instance = new_type(instance)
希望这有帮助。你知道吗
如果我明白你想做什么。。。你知道吗
希望这有帮助。你知道吗
相关问题 更多 >
编程相关推荐