What happened to the exponent ^ and it's replaced with **?
Good morning, I noticed when coding with the latest version of Python 3.11. the exponent ^ bitwise operator does not compute as an exponent? But, if I’m understanding the methods of computation, ^ operand was expressed as a simplistic approach on a calculator to calculate exponents instead of typing out for example 2 x 2 x 2 x 2. Instead it would be written as 2^4 = 16 2*4 would mean 2 x 4 = 8. 2**4 = ????, I mean I guess this good too. When I am computing this 2^4= the answers takes on addition. And adds the two integers. I checked the documents and I don’t see anything about this mentioned in using the operands in Python. Is there anyway I can get feedback about this? When I was learning Python, this was an included operand in relation to exponent expressions. Thank you Desurae Councill Graduate Teaching Assistant School of Information Science and Technology Pennsylvania State University. Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows
On Fri, Jun 23, 2023, at 2:50 PM, Councill, Desurae wrote:
Good morning, I noticed when coding with the latest version of Python 3.11. the exponent ^ bitwise operator does not compute as an exponent? But, if I’m understanding the methods of computation, ^ operand was expressed as a simplistic approach on a calculator to calculate exponents instead of typing out for example 2 x 2 x 2 x 2. Instead it would be written as 2^4 = 16 2*4 would mean 2 x 4 = 8. 2**4 = ????, I mean I guess this good too.
Hi Desurae, I cannot remember that Python used ^ for exponentation at any time. It has been 'bitwise XOR' for a long time, you can look up the relevant documentation for the version where you think it meant something else. Here's a link to the old Python 2 documentation showing that ^ meant bitwise XOR: https://docs.python.org/2/library/operator.html#mappingoperatorstofunctio...
When I am computing this 2^4= the answers takes on addition. And adds the two integers.
It does not take on addition, that's a result of that specific bitwise operation: 0b010 XOR 0b100 > 0b110. If you take another example, say, 3 ^ 5 the result is 6 due to 0b011 XOR 0b101 > 0b110. Hope this clarifies things. Regards, Simon
participants (2)

Councill, Desurae

Simon de Vlieger