是否可以从基类的实例创建派生类型的实例
像这样的事情:
class Reference (object):
pass
new_type = type ('{0}_refrence'.format (type (instance).__name__),
(type (instance), Reference), {})
new_instance = new_type (instance)
我想让实例从Refrence派生,但表现得像往常一样...... 是否可以? 提前谢谢!
Some thing like this:
class Reference (object):
pass
new_type = type ('{0}_refrence'.format (type (instance).__name__),
(type (instance), Reference), {})
new_instance = new_type (instance)
I want to make instance to be derived from Refrence but behave as usual...
Is it possible?
Thx in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我明白你想做什么...
希望这会有所帮助。
If I understood what you want to do...
Hope this helps.