from __numerics__ import rational

Chris Gonnerman chris.gonnerman at newcenturycomputers.net
Thu Jul 26 01:53:46 EDT 2001


Guido recently shot down my proposal for a magic __numerics__ module,
based largely on the idea that the old semantics could never be removed.
In another posting I state that you *can* remove the original semantics,
producing (for instance) a DeprecationError exception so that the user
knows as soon as the module compiles that it isn't going to work.

I have an ulterior motive for this proposal.  I don't like rationals,
for the very pragmatic reason that even Guido mentions the "mysterious
inefficiencies" of programs using rational numbers.  On the other hand,
there are some strong supporters of rational numbers who have just as
much right to their opinions as I do.

My proposal gives a mechanism for specifying that a given module needs
(for instance) support for automatic rational arithmetic, which could
then be off by default.  It would also be straightforward to add support
for fixedpoints and/or decimal floats, which I would very much like to 
have but which the rational guys could care less about.

My proposal is certainly not the only way to support numeric operation
control; I don't even care if Guido et al use it.  I just want to be
sure that the needs of the rational crew aren't allowed to harm the 
rest of us, and likewise our disinterest in rationals doesn't harm them.

I don't mind int/int => float; I'll probably avoid using the / operator
with integers from now on anyway.  I just don't want to accidentally get
a rational number when I don't want one.

I guess that makes me irrational...  ;)






More information about the Python-list mailing list