【发布时间】:2015-12-04 13:59:20
【问题描述】:
我有一个关键字库。我有一些类和子类,但是我遇到了继承和关键字被双重定义的问题。例如:
MyLib.py
class Class1:
def __init__(self):
pass
def do_something_generic(self):
#do stuff that is generic to all subclasses
pass
class Subclass1(Class1):
def __init__(self):
pass
def do_something_specific_to_subclass1(self):
#something specific
pass
class Subclass2(Class1):
def __init__(self):
pass
def do_something_specific_to_subclass2(self):
#something specific
pass
具体的关键字工作正常,但当我尝试调用Do Something Generic 时,我得到Multiple keywords with name 'Do Something Generic' found。我可以用MyLib.Class1.Do Something Generic 完全限定库名称,但是有没有办法将Do Something Generic 定义为始终引用超类,因为该方法仅在那里定义并且只是由子类继承?
【问题讨论】:
标签: python inheritance robotframework