What does this mean in Python:
sock.recvfrom(2**16)
I know what sock is, and I get the gist of the recvfrom
function, but what the heck is 2**16
? Specifically, the two asterisk/double asterisk operator?
(english keywords, because it's hard to search for this: times-times star-star asterisk-asterisk double-times double-star double-asterisk operator)
Multiplication Operator: In Python, the multiplication operator is *. Furthermore, its use takes place to find the product of 2 values.
The * operator also works on strings. It performs repetition. For example, 'Fun'*3 is 'FunFunFun' . One of the operands has to be a string and the other has to be an integer.
It is the power operator.
From the Python 3 docs:
The power operator has the same semantics as the built-in pow() function, when called with two arguments: it yields its left argument raised to the power of its right argument. The numeric arguments are first converted to a common type, and the result is of that type.
It is equivalent to 216 = 65536, or pow(2, 16)
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