Python __iand__() Magic Method

Syntax object.__iand__(self, other) The Python __iand__() magic method implements the in-place bitwise AND x &= y that calculates the result of the bitwise AND operation x & y, and assigns it to the first operands’ variable x. This type of in-place operation is also called augmented arithmetic assignment. The method simply returns the new value … Read more

Python __ipow__() Magic Method

Syntax object.__ipow__(self, other) The Python __ipow__() magic method implements the in-place exponentiation x **= y that calculates the result of the power function x ** y, and assignsit to the first operands’ variable x. This type of in-place operation is also called augmented arithmetic assignment. The method simply returns the new value to be assigned … Read more

Python __imod__() Magic Method

Syntax object.__imod__(self, other) The Python __imod__() magic method implements the in-place modulo operation x %= y that calculates the modulo operation x % y, and assigns the result to the first operands variable x. This type of in-place operation is also called augmented arithmetic assignment. The method simply returns the new value to be assigned … Read more

Python __ifloordiv__() Magic Method

Syntax object.__ifloordiv__(self, other) The Python __ifloordiv__() magic method implements the in-place floor division operation x //= y that calculates the integer division operation x // y, and assigns the result to the first operands variable x. This operation is also called augmented arithmetic assignment. The method simply returns the new value to be assigned to … Read more

Python __itruediv__() Magic Method

Syntax object.__itruediv__(self, other) The Python __itruediv__() magic method implements the in-place division operation x /= y that calculates the division operation x / y, and assigns the result to the first operands variable x. This operation is also called augmented arithmetic assignment. The method simply returns the new value to be assigned to the first … Read more

Python __irshift__() Magic Method

Syntax object.__irshift__(self, other) The Python __irshift__() magic method implements in-place bitwise right-shift operation x >>= y that calculates the right-shift operation x >> y, and assigns the result to the first operands variable x. This operation is also called augmented arithmetic assignment. The method simply returns the new value to be assigned to the first … Read more

Python __ilshift__() Magic Method

Syntax object.__ilshift__(self, other) The Python __ilshift__() magic method implements in-place bitwise left-shift operation x <<= y that calculates the left-shift operation x << y, and assigns the result to the first operands variable x. This operation is also called augmented arithmetic assignment. The method simply returns the new value to be assigned to the first … Read more

Python __imatmul__() Magic Method

Syntax object.__imatmul__(self, other) The Python __imatmul__() magic method implements in-place matrix multiplication x @= y that calculates the matrix multiplication of the two operands and assigns the result to the left operand. This operation is also called augmented arithmetic assignment. The method simply returns the new value to be assigned to the first operand. When … Read more

Python __imul__() Magic Method

Syntax object.__imul__(self, other) The Python __imul__() magic method implements in-place multiplication x *= y that multiplies the operands with each other and assigns the result to the left operand. This operation is also called augmented arithmetic assignment. The method simply returns the new value to be assigned to the first operand. When you call x … Read more

Python __isub__() Magic Method

Syntax object.__isub__(self, other) The Python __isub__() magic method implements in-place subtraction x -= y that subtracts the operands from each other and assigns the result to the left operand. This operation is also called augmented arithmetic assignment. The method simply returns the new value to be assigned to the first operand. When you call x … Read more

Python __iadd__() Magic Method

Syntax object.__iadd__(self, other) The Python __iadd__() magic method implements in-place addition x += y that adds together the operands and assigns the result to the left operand. This operation is also called augmented arithmetic assignment. The method simply returns the new value to be assigned to the first operand. When you call x += y, … Read more

Python __rrshift__() Magic Method

Syntax object.__rrshift__(self, other) The Python __rrshift__() method implements the reverse bitwise right-shift operation with reflected, swapped operands. So, when you call x >> y, Python attempts to call x.__rshift__(y). If the method is not implemented, Python attempts to call y.__rrshift__(x) on the right operand and if this isn’t implemented either, it raises a TypeError. The … Read more