[Edu-sig] re: None potato, one potato, two potato, more..
Arthur
ajsiegel at optonline.net
Thu Jan 1 17:56:58 EST 2004
JC writes -
>But it's also much harder than it ought to be, and often intially for many
>pretty basic counter-intuitive reasons. And if not counter-intuitive, at
>least contra-status quo.
So we can focus on the point at hand let's (and I will never argue with it
as toggle option):
>>> from __future__ import division
We know " ** " is the power operator and want to raise to a fractional
power:
first try:
>>> 16**3/4
1024.0
Which is clearly not the answer I am expecting
second try:
>>> 16**(3/4)
8.0
Which is.
And I am sure long debates could ensue about which is more intuitive and
whether the language could be improved by adjusting the parser to recognize
what I meant in try one, i.e. adjust the operator precedence order.
But my second try is good enough for me, and I now know the rules for my 3rd
to 3 millionth try. The burden now is where it rightly belongs, with me.
And if I choose to give up programming in disgust with the fact it took me
two tries - well that's up to me.
But Guido can relax and enjoy his New Year, I hope.
Art
More information about the Edu-sig
mailing list