Issue 31127: Abstract classes derived from built-in classes don't block instance creation (original) (raw)
The only check that prevents instantiating abstract classes is in object.new, but most built-in classes never actually call object.new. That means you can do stuff like
import abc
class Foo(list, metaclass=abc.ABCMeta): @abc.abstractmethod def abstract(self): pass
Foo()
and the Foo() call will silently succeed.
Ideally, the Foo() call should fail. Other options include having the Foo class definition itself fail, or just making a note in the documentation describing the limitation. (As far as I can see, this is currently undocumented.)