@@ -228,9 +228,21 @@ The following exceptions are the exceptions that are usually raised.
228228.. exception :: NotImplementedError
229229
230230 This exception is derived from :exc: `RuntimeError `. In user defined base
231- classes, abstract methods should raise this exception when they require derived
232- classes to override the method.
231+ classes, abstract methods should raise this exception when they require
232+ derived classes to override the method, or while the class is being
233+ developed to indicate that the real implementation still needs to be added.
233234
235+ .. note ::
236+
237+ It should not be used to indicate that an operater or method is not
238+ meant to be supported at all -- in that case either leave the operator /
239+ method undefined or, if a subclass, set it to :data: `None `.
240+
241+ .. note ::
242+
243+ ``NotImplementedError `` and ``NotImplemented `` are not interchangeable,
244+ even though they have similar names and purposes. See
245+ :data: `NotImplemented ` for details on when to use it.
234246
235247.. exception :: OSError([arg])
236248 OSError(errno, strerror[, filename[, winerror[, filename2]]])
@@ -436,6 +448,15 @@ The following exceptions are the exceptions that are usually raised.
436448 Raised when an operation or function is applied to an object of inappropriate
437449 type. The associated value is a string giving details about the type mismatch.
438450
451+ This exception may be raised by user code to indicate that an attempted
452+ operation on an object is not supported, and is not meant to be. If an object
453+ is meant to support a given operation but has not yet provided an
454+ implementation, :exc: `NotImplementedError ` is the proper exception to raise.
455+
456+ Passing arguments of the wrong type (e.g. passing a :class: `list ` when an
457+ :class: `int ` is expected) should result in a :exc: `TypeError `, but passing
458+ arguments with the wrong value (e.g. a number outside expected boundaries)
459+ should result in a :exc: `ValueError `.
439460
440461.. exception :: UnboundLocalError
441462
0 commit comments