There is a code and in class' method there is a line:
object.attribute |= variable
I can't understand what it means. I didn't find (|=) in the list of basic Python operators.
Vertical bar (|) stands for bitwise or operator. In case of two integer objects, it returns bitwise OR operation of two >>> a=4 >>> bin(a) '0b100' >>> b=5 >>> bin(b) '0b101' >>> a|b 5 >>> c=a|b >>> bin(c) '0b101' Pythonista. © Copyright 2022.
It is located right above the Enter key. Another way to type the vertical bar character is to turn on the numeric keypad, hold ALT , then press 1, 2, and 4.
A bar plot shows catergorical data as rectangular bars with the height of bars proportional to the value they represent. It is often used to compare between values of different categories in the data.
(|) is a Bitwise OR operator if any one or both of the bits is 1, it results 1 if both the bits are zero 0, it results in 0 10|20 = 30 Binary Decimal 0000 1010 10 | 0001 0100 20 -------------------------------------- 0001 1110 30 1|0 = 1 1&0 = 0 1|1 = 1 1&1 = 1 0|0 = 0 0&0 = 0 Check out the lesson 👇 https://www. ...
That is a bitwise or
with assignment. It is equivalent to
object.attribute = object.attribute | variable
Read more here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With