Python Intermediate: Operator Overloading

preview_player
Показать описание
Welcome to another tutorial in the intermediate series, this tutorial is about operator overloading. So in programming terms operator overloading basically means using an operator for multiple different tasks. You can change the meaning of an operator in Python depending upon the operands used.
So for example we can use the + operator to add two numbers and get the addition of those numbers. And we can also use the + operator two concatenate two strings. So we are overloading the plus operator for different results.

+ : __add__ ()
- : __sub__ ()
* : __mul__ ()
== : __eq__()
!= : __ne__()

(Affiliate Link, Helps the Channel)

Discord Server:
Рекомендации по теме
Комментарии
Автор

amazing content, the only channel that shows me how to really code

mnothing
join shbcf.ru