I am writing python classes with abc module to define abstract class and using sub-class to implement the abstract method. However, when i tried to use pylint to justify it, pylint keeps saying my subclass is "interface not implemented". I am a little bit confused how pylint regards a class is an interface. Could anyone shed some light on me?
Here is my example code. When i call pylint mytest.py
, the result is as R0923: 17:MyClass: Interface not implemented
.
import abc
class MyInterface(object):
"""docstring for MyInterface"""
__metaclass__ = abc.ABCMeta
def __init__(self, arg):
self.arg = arg
@abc.abstractmethod
def test(self):
pass
class MyClass(MyInterface):
"""docstring for MyClass"""
def __init__(self, arg):
super(MyClass, self).__init__(arg)
def test(self):
"""docstring for test"""
print self.arg