A Revised Rational Proposal
newsgroups at jhrothjr.com
Sun Dec 26 19:03:22 CET 2004
"Steven Bethard" <steven.bethard at gmail.com> wrote in message
news:iWCzd.19458$k25.5585 at attbi_s53...
> Dan Bishop wrote:
>> Mike Meyer wrote:
>> 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 docstring conventions, e.g. triple-quoted strings.
> Use PEP 8 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.
I'd suggest making them public rather than either protected or
private. There's a precident with the complex module, where
the real and imaginary parts are exposed as .real and .imag.
> Thanks again for your work!
>  http://www.python.org/peps/pep-0257.html
>  http://www.python.org/peps/pep-0008.html
More information about the Python-list