What is the associativity of Python's ** operator?
python
Solution
2** (2**(2**2))
from http://docs.python.org/reference/expressions.html
Operators in the same box group left to right (except for comparisons, including tests, which all have the same precedence and chain from left to right — see section Comparisons — and exponentiation, which groups from right to left).
Problem
I was just playing around with the python command line and the ** operator, which as far as I know performs a power function. So 2 ** 3 should be (and is) 8 because 2 * 2 * 2 = 8. Can someone explain the behavior I found? I don't see any way to group the operations with parentheses to actually get a result of 65536 like was attained here. ``` >>> 2 ** 2 ** 2 16 >>> 2 ** 2 ** 2 ** 2 65536 >>> (2 ** 2 ** 2) ** 2 256 ```