Tuesday, March 2, 2010

Not Implemented

What makes more sense with abstract operations in Python, to pass silently or to raise a NotImplementedError exception?

The pass is easy to implement quickly and it is usually obvious to developers reading the code that the operation is abstract. During the execution of the program, if the chain of invocation leads to an empty, abstract method, it could lead to very subtle problems.

The NotImplementedError can at least be handled and some logs might be produced complaining about the lack of an implementation.

No comments :

Post a Comment