math.nroot [was Re: A brief question.]
OKB (not okblacke)
brenNOSPAMbarn at NObrenSPAMbarn.net
Mon Jul 4 03:09:46 EDT 2005
Tom Anderson wrote:
> Yes. However, it's an excellent reason why python's precedence
> rules are wrong - in conventional mathematical notation, the unary
> minus, used to denote the sign of a literal number, does indeed
> have higher precedence than exponentiation: -1^2 evaluates to 1,
> not -1.
This isn't true. The "unary minus operator" is just a shorthand
for multiplication by -1. As such, it has the same operator precedence
as multiplication.
--
--OKB (not okblacke)
Brendan Barnwell
"Do not follow where the path may lead. Go, instead, where there is
no path, and leave a trail."
--author unknown
More information about the Python-list
mailing list