Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
NotImplementedError is derived from RuntimeError. Which methods should raise this exception when they require derived classes to override the method in user defined classes?.
User-defined base classes can raise NotImplementedError to indicate that a method or behavior needs to be defined by a subclass, simulating an interface. This exception is derived from RuntimeError. In user defined base classes, abstract methods should raise this exception when they require derived classes to override the method.
import sys
try:
class Super(object):
@property
def example(self):
raise NotImplementedError("Subclasses should implement this!")
s = Super()
print s.example
except Exception as e:
print e
print sys.exc_type
OUTPUT
Subclasses should implement this!
<type 'exceptions.NotImplementedError'>