I have tried to find out about these operations in Python:
x|3
x^3
x>>=3
x<<=3
I couldn't find anything. Please can anyone tell me what are these operations are called, so that I can search more about them.
I have tried to find out about these operations in Python:
x|3
x^3
x>>=3
x<<=3
I couldn't find anything. Please can anyone tell me what are these operations are called, so that I can search more about them.
See: https://docs.python.org/3/reference/datamodel.html#emulating-numeric-types
Python has methods known as "magic" or "dunder" (i.e. double-under) methods like __add__()
that define what happens when operators like +
are used.