+ -
当前位置:首页 → 问答吧 → 如何限制一个子类必需实现某一方法

如何限制一个子类必需实现某一方法

时间:2011-01-17

来源:互联网

和ABC有一点相似

类A继承另外一个类,比如,dict
限制所有继承类A的子类都必需实现一个方法,比如,method1

ABC/abstractmethod貌似不适合这样的情况
各位大侠,有什么方法可以实现么?

作者: beyond_touch   发布时间: 2011-01-17

it is a problem caused by built-in object

use UserDict from collections instead of dict

作者: beyond_touch   发布时间: 2011-01-23