HELP: restore my faith in Python
Moshe Zadka
moshez at math.huji.ac.il
Sun Mar 5 00:54:06 EST 2000
On Sat, 4 Mar 2000, Tim Peters wrote:
> > 1. It can't return 0.5 -- floating point sucks
> > 2. It can't return Rational(1, 2) -- rational arithmetic blows up
> > 3. It can't return 0 -- integer division is confusing
> >
> > (Note that I do agree on 1 and 3, and you managed to convince me about 2)
>
> I think P3K should opt for #2, on the principle of least initial surprise.
> You have to become an expert to deal with *any* of them if you're going to
> proceed to non-trivial things, but #2 probably manages to hide that
> unpleasant truth a little longer, and when it screws you it's for space/time
> reasons rather than correctness ones.
Yay! It's two of us against one Guido. It's an easy win, unless Guido
pulls that BDFL trick.
> > i-fear-the-decimal-point-ly y'rs, Z.
>
> Your fear of the binary point is much deeper <wink>.
Actually, no: both scare me equally. For what I do, 2 and 10 are just as
bad -- it's the finite numbers of bits I'm fighting against. And I can't
even take the rational way out: I have to deal with square roots and
trigonometry.
> No no, slash arithmetics are sufficiently useless for me!
I had such a feeling, but waited for you to say it yourself.
> They give the
> illusion of not losing info in simple cases (1/3, 7/10), then suddenly lose
> info as soon as the sum of the bitlengths of the numerator & denominator
> "gets too big". Their primary attraction is in making division as fast as
> multiplication -- provided you have special HW support for fast GCD.
Reminds me that RMS always says VLSI sucks, because you can't add
instructions to the CPU anymore.
> In the
> absence of that, they make everything (much) slower than fp.
Slow, weird, and confuses newbie in brand new ways. Hmmmmmm....let's go
for it.
and-let's-have-regexes-built-in-to-the-language-too-ly y'rs, Z.
--
Moshe Zadka <mzadka at geocities.com>.
http://www.oreilly.com/news/prescod_0300.html
More information about the Python-list
mailing list