> On Mar 13, 2018, at 12:07 PM, Guido van Rossum <gu...@python.org> wrote:
> OK, please make it so.

Will do.  I'll create a tracker issue right away.

Since this one looks easy (as many things do at first), I would like to assign 
it to Nofar Schnider (one of my mentees).


> On Tue, Mar 13, 2018 at 11:39 AM, Raymond Hettinger 
> <raymond.hettin...@gmail.com> wrote:
> > On Mar 13, 2018, at 10:43 AM, Guido van Rossum <gu...@python.org> wrote:
> >
> > So let's make as_integer_ratio() the standard protocol for "how to make a 
> > Fraction out of a number that doesn't implement numbers.Rational". We 
> > already have two examples of this (float and Decimal) and perhaps numpy or 
> > the sometimes proposed fixed-width decimal type can benefit from it too. If 
> > this means we should add it to int, that's fine with me.
> I would like that outcome.
> The signature x.as_integer_ratio() -> (int, int) is pleasant to work with.  
> The output is easy to explain, and the denominator isn't tied to powers of 
> two or ten. Since Python ints are exact and unbounded, there isn't worry 
> about range or rounding issues.
> In contrast, math.frexp(float) ->(float, int) is a bit of pain because it 
> still leaves you in the domain of floats rather than letting you decompose to 
> more more basic types.  It's nice to have a way to move down the chain from 
> ℚ, ℝ, or ℂ to the more basic ℤ (of course, that only works because floats and 
> complex are implemented in a way that precludes exact irrationals).
> Raymond
> -- 
> --Guido van Rossum (python.org/~guido)

Python-Dev mailing list

Reply via email to