MCPcopy Index your code
hub / github.com/python/cpython / _from_coprime_ints

Method _from_coprime_ints

Lib/fractions.py:362–371  ·  view source on GitHub ↗

Convert a pair of ints to a rational number, for internal use. The ratio of integers should be in lowest terms and the denominator should be positive.

(cls, numerator, denominator, /)

Source from the content-addressed store, hash-verified

360
361 @classmethod
362 def _from_coprime_ints(cls, numerator, denominator, /):
363 """Convert a pair of ints to a rational number, for internal use.
364
365 The ratio of integers should be in lowest terms and the denominator
366 should be positive.
367 """
368 obj = super(Fraction, cls).__new__(cls)
369 obj._numerator = numerator
370 obj._denominator = denominator
371 return obj
372
373 def is_integer(self):
374 """Return True if the Fraction is an integer."""

Callers 13

from_numberMethod · 0.80
from_floatMethod · 0.80
from_decimalMethod · 0.80
limit_denominatorMethod · 0.80
_addMethod · 0.80
_subMethod · 0.80
_mulMethod · 0.80
_divMethod · 0.80
__pow__Method · 0.80
__pos__Method · 0.80
__neg__Method · 0.80
__abs__Method · 0.80

Calls 2

superClass · 0.85
__new__Method · 0.45

Tested by 1

test_fractionsMethod · 0.64