Author mark.dickinson
Recipients benlbroussard, mark.dickinson
Date 2009-08-25.12:35:08
SpamBayes Score 8.58608e-05
Marked as misclassified No
Message-id <1251203710.03.0.64386610935.issue6781@psf.upfronthosting.co.za>
In-reply-to
Content
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
>>>
History
Date User Action Args
2009-08-25 12:35:10mark.dickinsonsetrecipients: + mark.dickinson, benlbroussard
2009-08-25 12:35:10mark.dickinsonsetmessageid: <1251203710.03.0.64386610935.issue6781@psf.upfronthosting.co.za>
2009-08-25 12:35:08mark.dickinsonlinkissue6781 messages
2009-08-25 12:35:08mark.dickinsoncreate