I'm looking at Python's built-in exceptions and wondering what the closest equivalent of Java's UnsupportedOperationException
is. NotImplementedError
is close but seems to suggest something slightly different. Should I be using RuntimeError
or implementing my own Exception
?
The closest equivalent is to simply not implement the unsupported method. The resulting exception if you try to use the nonexistent method is an AttributeError
.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments