Is it possible to make abstract classes in Python?
How can I make a class or method abstract in Python? I tried redefining __new__() like so: class F: def __new__(cls): raise Exception("Unable to create an instance of abstract class %s" %cls) but now if I create a class G that inherits from F like so: class G(F): pass then I can't instantiate G either, since it calls its super class's __new__ method. Is there a better way to define an abstract class? alexvassel Use the abc module to create abstract classes. Use the abstractmethod decorator to declare a method abstract, and declare a class abstract using one of three ways, depending upon your