Modifying the lshift dunder

We are modifying the lshift dunder lshift() to make it do our desired work… but what does the lshift dunder actually do??? As we add two objects like a + b [where a and b are two objects] then internally the dunder add() is called… then when the dunder lshift() is called?

hey @bihan,
you might know that there are operators , + ,<< , etc…
and as you said when we do + , it calls __add__ , similarly when we call lift shift operator << then it is called.

<< means , shifting the binary value to left by 1 or any number as stated.

I hope this helps.

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.