Mark Dickinson <dicki...@gmail.com> added the comment:

This is not a bug:

-1 ** 2 is parsed as -(1 ** 2), not (-1) ** 2.  Take a look at:

http://docs.python.org/reference/expressions.html#the-power-operator

In -1 ^ 2, ^ is the bitwise exclusive-or operator, not the power operator.

pow(x, y) is indeed equivalent to x**y:

Python 2.6.2 (r262:71600, Aug 22 2009, 17:53:25) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> x = -1
>>> y = 2
>>> x ** y
1
>>> pow(x, y)
1
>>>

----------
nosy: +marketdickinson
resolution:  -> invalid
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue6781>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to