math.nroot [was Re: A brief question.]

Steven D'Aprano steve at REMOVEMEcyber.com.au
Sun Jul 3 23:31:59 EDT 2005


James Dennett wrote:

> > Yes: 5^2 + -2^2 is 29, however you write it.
> 
> *If* you take -2 as a number, but not if you take the number
> as 2 and the unary minus as an operator with lower precedence
> than exponentiation.

[snip]

> Not in this respect.  However, the question is whether that's
> a unary -, which binds lower than exponentiation in most systems,
> or part of the negative number minus 2.

In Python, all numbers are positive. -2 is a unary 
minus in front of 2.

-- 
Steven.




More information about the Python-list mailing list