What's the safest approach to going about requiring inheritance? Currently I'm doing something similar to this:
>>> class A: # Never instantiate by itself.
... def a(self):
... self.foo()
...
... class B(A):
... def foo(self):
... print('123')
...
... class C(A):
... def foo(self):
... print('456')
...
>>> B().a()
123
C().a()
456
>>> A().a() # Expect an error.
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "<input>", line 3, in a
AttributeError: 'A' object has no attribute 'foo'
Is this the best approach?