Vladimir

57%
Flag icon
unary and infix operators are supposed to produce results by creating new objects, and should never change their operands. To support operations with other types, we return the NotImplemented special value—not an exception—allowing the interpreter to try again by swapping the operands and calling the reverse special method for that operator (e.g., __radd__).
Fluent Python: Clear, Concise, and Effective Programming
Rate this book
Clear rating
Open Preview