[Python-3000] Updated and simplified PEP 3141: A Type Hierarchy for Numbers

Paul Moore p.f.moore at gmail.com
Thu Aug 23 18:20:27 CEST 2007


On 22/08/07, Guido van Rossum <guido at python.org> wrote:
> > * Add Demo/classes/Rat.py to the stdlib?
>
> Yes, but it needs a makeover. At the very least I'd propose the module
> name to be rational.

If no-one else gets to this, I might take a look. But I'm not likely
to make fast progress as I don't have a lot of free time... (And I
don't have a Windows compiler, so I'll need to set up a Linux VM and
find out how to build Py3K on that!)

> The code is really old.

Too right - it's riddled with "isinstance" calls which probably aren't
very flexible, and it seems to try to handle mixed-mode operations
with float and complex, which I can't see the use for...

Given that the basic algorithms are pretty trivial, the major part of
any makeover would be rewriting the special method implementations to
conform to the Rational ABC. A makeover is probably more or less a
rewrite. I wrote a rational number class in C++ for Boost once, it
wouldn't be too hard to port.

Paul.


More information about the Python-3000 mailing list