According to the docs it should work to combine @property
and @abc.abstractmethod
so the following should work in python3.3:
import abc
class FooBase(metaclass=abc.ABCMeta):
@property
@abc.abstractmethod
def greet(self):
""" must be implemented in order to instantiate """
pass
@property
def greet_comparison(self):
""" must be implemented in order to instantiate """
return 'hello'
class Foo(FooBase):
def greet(self):
return 'hello'
test the implementation:
In [6]: foo = Foo()
In [7]: foo.greet
Out[7]: <bound method Foo.greet of <__main__.Foo object at 0x7f935a971f10>>
In [8]: foo.greet()
Out[8]: 'hello'
so it is obviously not a property, because then it should work like that:
In [9]: foo.greet_comparison
Out[9]: 'hello'
Maybe I'm to stupid or it simply doesn't work, somebody has an idea?