On 19/01/2008, Jeffrey Yasskin <[EMAIL PROTECTED]> wrote:
> The first returns the closest rational whose denominator is less than
> a given integer.
[...]
> The second returns the simplest rational within some distance.

Both of these are likely to be of limited use. The most common usage I
know of is to make a "sensible" rational from a float (i.e., a DWIM
style conversion 0.1 -> 1/10) or to provide readable output. On the
other hand, both are subtle to implement, so having a standard
implementation saves people having to code (and debug) their own.

I suspect that simplest within a particular distance is the form that
is most often wanted, but I don't have any good evidence for that
feeling. Putting both in might help people to realise that there *is*
a choice.

Given that you have implemented them, I'd say leave them in. And I
like the names trim and approximate, as given in the code you
referenced.

Paul.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to