Indicating Unimplemented Features with NotImplementedError
NotImplementedError
is an exception used to indicate that a certain feature has not been implemented yet.
It is primarily used during the development process to mark functionalities that will be implemented later.
Example Usage of NotImplementedError
number = 11
if number > 10:
raise NotImplementedError("Handling for numbers greater than 10 is not yet implemented")
else:
print("The number is 10 or less.")
In the code example above, if the variable number
exceeds 10
, a NotImplementedError
is raised.
At this time, the message of the NotImplementedError
indicates "Handling for numbers greater than 10 is not yet implemented".
Similar to the pass
keyword, NotImplementedError
is used to mark functions that will be implemented in the future but more explicitly conveys the necessity of implementation.
Want to learn more?
Join CodeFriends Plus membership or enroll in a course to start your journey.