Martin v. Löwis mar...@v.loewis.de added the comment:
This is expected behavior. The power operator binds with higher precedence than
the unary minus:
http://docs.python.org/reference/expressions.html#unary-arithmetic-and-bitwise-operations
Therefore, your term is interpreted as
-(4 ** 2)
Chris Ward cward...@gmail.com added the comment:
Thanks for clearing that up and pointing me in the right direction. I should
have tested print first. The assumption was based on the evaluation of (-4) **
2 within an expression, which does return correctly. I hadn't made the
distinction that
New submission from Chris Ward cward...@gmail.com:
When using exponentiation interactively in the python shell, it returns all
negative results when a negative number is the input. For example:
-4 ** 2 will return -16
-4 ** 2 should evaluate as -4 * -4, which correctly returns 16
This does