ইউজার-ডিফাইনড বেস ক্লাসগুলো NotImplementedError রেইজ করতে পারে একটি মেথড বা বিহেভিয়ার সাবক্লাসে ডিফাইন করা দরকার তা নির্দেশ করতে, একটি ইন্টারফেস সিমুলেট করে। এই এক্সসেপশন RuntimeError-এর থেকে ডেরাইভ করা। ইউজার ডিফাইনড বেস ক্লাসে, অ্যাবস্ট্রাক্ট মেথডগুলো এই এক্সসেপশন রেইজ করা উচিত যখন সেগুলো ডেরাইভড ক্লাসকে মেথড ওভাররাইড করতে চায়।
উদাহরণ
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)
আউটপুট
Subclasses should implement this! <type 'exceptions.NotImplementedError'>