【发布时间】:2015-11-27 14:55:33
【问题描述】:
我正在编写一个代码,其中有一个名为 Soft_Constr 的超类,按以下方式制作:
def __init__(self, prop, name, static_init, static_lit, pred, kind):
init_method ...
def evaluate_clause(self):
code here
还有一些子类可以调用超类中定义的方法“evaluate_clause”。有没有办法捕获哪些子类调用了 Soft_Constr 类中的“evaluate_clause”?
def evaluate_clause(self):
subclasses = method_to_get_subclasses(...)
【问题讨论】:
-
self.__class__...?! – 我想谨慎地问为什么...
标签: python inheritance subclass superclass super