[Python-3000] Math in Python 3.0

"Martin v. Löwis" martin at v.loewis.de
Sat May 13 17:35:37 CEST 2006


Fredrik Johansson wrote:
> Python's current numeric model has serious problems.

Some of us (including myself) probably need enlightenment first:
what are the serious problems specifically?

> It's fine for
> calculating with nothing but floats, or nothing but ints, but writing
> code that works for ints, floats, complexes *and* Decimals - let alone
> for custom types such as mpfs or numeric arrays - is nearly
> impossible. Duck typing doesn't work because these types all have
> different interfaces, despite being functionally (or conceptually)
> equivalent for many purposes.

Why do you say that? To me, it seems that these types have all
*precisely* the same operations: +, -, *, /.

> Generic functions would solve most of the problem. I don't see this
> example being brought up often (perhaps I've just missed those posts),
> but I do think improved support for custom numeric types is a very
> strong motivation for implementing generic functions in Python 3.0.

My guess is that it isn't brought up very often because very few
people have the problem you are talking about.

Regards,
Martin



More information about the Python-3000 mailing list