
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#mapping-operators-to-functio...
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