-3

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.

khelwood
  • 55,782
  • 14
  • 81
  • 108
  • bitwise or, bitwise xor, in-place right shift, in-place left shift. Reference [Bitwise operation](https://en.wikipedia.org/wiki/Bitwise_operation). – Mechanic Pig Jul 27 '22 at 08:18
  • 2
    Please ignore the answers that were posted to this question before it was closed. They are awfully wrong. `^` is ***not*** "to the power of", and `>>=` is ***not*** "greater than". – Stef Jul 27 '22 at 09:11
  • `>>=` and `<<=` are not in-place since integers are immutable in Python. – Matthias Jul 27 '22 at 09:11

1 Answers1

0

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.

Kache
  • 15,647
  • 12
  • 51
  • 79