About Lesson
Operator overloading in Python is the ability of a single operator to perform more than one operation based on the type of operands. For example the + operator performs addition on two numbers, merges two lists, or concatenates two strings or more strings.
Unary Operator | Method |
---|---|
+ | __pos__(self) |
– | __neg__(self) |