[Python-Dev] Revamping Python's Numeric Model

Moshe Zadka py-dev@zadka.site.co.il
Sat, 04 Nov 2000 20:19:13 +0200

> While I like the idea of having the numeric model in Python
> based on a solid class hierarchy, I don't think that this model
> is implementable in Python 2.x without giving away performance.

I think they are, using a similar trick to Fred's automorphing dictionaries.

> +1.
> I would like to see methods on Python numbers too (after having
> made some really good experiences with methods on strings ;-).
> There's one problem though: how would you call these on
> numeric literals ? ... 1.2.isreal() ?!

Ummmm....how would you say you want to add 3 and 4, and multiply the result
by 5? 3+4*5?

No, you use parens:


> >     a. isexact()
> > 
> >     Obviously, a number which answers m as true, also answers m+k as true.
> >     If "isexact()" is not true, then any answer might be wrong. (But not
> >     horribly wrong: it's close the truth).
> Not sure what you mean here: perhaps .isexact() <=> can be
> represented in IEEE ?

No, I meant "not represented exactly". The real meaning for that (one
that we might or might not promise) is that it's a float. It's a place 
where the numeric model takes the easy way out <wink>.

Moshe Zadka <sig@zadka.site.co.il>