[Python-Dev] Rational approximation methods (original) (raw)
Mark Dickinson dickinsm at gmail.com
Sun Jan 20 02:22:40 CET 2008
- Previous message: [Python-Dev] Rational approximation methods
- Next message: [Python-Dev] Rational approximation methods
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Jan 19, 2008 3:06 PM, Jeffrey Yasskin <jyasskin at gmail.com> wrote:
In the Rational class that I've recently checked into Python 2.6 (http://bugs.python.org/issue1682), it might be nice to provide a method that, given a particular rational number, returns a nearby number that's nicer in some way. I know of two reasonable behaviors [...] What does the list think?
I'm having trouble imagining a real use case for either of these methods. When I'm using Rational, it's almost certainly because I want exact arithmetic; if I'm getting results with huge denominators and numerators then either that's what I really want, or I probably shouldn't have been using Rational in the first place...
The only semi-use case I see is providing some way for users to turn the float 1.1 into the rational 11/10, instead of Rational(2476979795053773L,2251799813685248L).
So I'd say leave both these methods out for now---it would be easy enough to add them later if it turns out there's a real need.
Just my 200/391 UK pennies :)
Mark -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-dev/attachments/20080119/1ab61ba1/attachment.htm
- Previous message: [Python-Dev] Rational approximation methods
- Next message: [Python-Dev] Rational approximation methods
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]