Vladimir

55%
Flag icon
if an operator special method cannot return a valid result because of type incompatibility, it should return NotImplemented and not raise TypeError. By returning NotImplemented, you leave the door open for the implementer of the other operand type to perform the operation when Python tries the reversed method call.
Fluent Python: Clear, Concise, and Effective Programming
Rate this book
Clear rating
Open Preview