Mathematics in Python are not correct

Lou Pecora pecora at anvil.nrl.navy.mil
Fri May 9 11:14:34 EDT 2008


In article <mailman.815.1210287883.12834.python-list at python.org>,
 Michael Torrie <torriem at gmail.com> wrote:

> wxPythoner at gmail.com wrote:
> > Have a look at this:
> > 
> >>>> -123**0
> > -1
> > 
> > 
> > The result is not correct, because every number (positive or negative)
> > raised to the power of 0 is ALWAYS 1 (a positive number 1 that is).
> 
> No python is correct.  you're expression parses this way, when converted
> to a lisp-ish prefix expression:
> 
> (- (123 ** 0 ))

Yeah, it's just the standard parser.  For other situations Python does 
fine.  E.g.

In [1]: x=-1

In [2]: x**0
Out[2]: 1

-- 
-- Lou Pecora



More information about the Python-list mailing list