[issue8353] Negative exponentiation behaving oddly in python shell

2010-04-09 Thread Martin v . Löwis
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)

[issue8353] Negative exponentiation behaving oddly in python shell

2010-04-09 Thread Chris Ward
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

[issue8353] Negative exponentiation behaving oddly in python shell

2010-04-08 Thread Chris Ward
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