Dan Bishop wrote:
Mike Meyer wrote:

PEP: XXX

I'll be the first to volunteer an implementation.

Very cool. Thanks for the quick work!

For stdlib acceptance, I'd suggest a few cosmetic changes:

Use PEP 257[1] docstring conventions, e.g. triple-quoted strings.

Use PEP 8[2] naming conventions, e.g. name functions from_exact_float, approx_smallest_denominator, etc.

The decimal and math modules should probably be imported as _decimal and _math. This will keep them from showing up in the module namespace in editors like PythonWin.

I would be inclined to name the instance variables _n and _d instead of the double-underscore versions. There was a thread a few months back about avoiding overuse of __x name-mangling, but I can't find it. It also might be nice for subclasses of Rational to be able to easily access _n and _d.

Thanks again for your work!

Steve

[1] http://www.python.org/peps/pep-0257.html
[2] http://www.python.org/peps/pep-0008.html
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to