class_docstr: This class implements rational numbers.
  
  In the two-argument form of the constructor, Fraction(8, 6) will
  produce a rational number equivalent to 4/3. Both arguments must
  be Rational. The numerator defaults to 0 and the denominator
  defaults to 1 so that Fraction(3) == 3 and Fraction() == 0.
  
  Fractions can also be constructed from:
  
    - numeric strings similar to those accepted by the
      float constructor (for example, '-2.3' or '1e10')
  
    - strings of the form '123/456'
  
    - float and Decimal instances
  
    - other Rational instances (including integers)
class_docstr_tok: ["This","class","implements","rational","numbers",".","In","the","two-argument","form","of","the","constructor",",","Fraction","(","8",",","6",")","will","produce","a","rational","number","equivalent","to","4\/3",".","Both","arguments","must","be","Rational",".","The","numerator","defaults","to","0","and","the","denominator","defaults","to","1","so","that","Fraction","(","3",")","==","3","and","Fraction","(",")","==","0",".","Fractions","can","also","be","constructed","from",":","-","numeric","strings","similar","to","those","accepted","by","the","float","constructor","(","for","example",",","'-2.3","'","or","'1e10","'",")","-","strings","of","the","form","'123\/456'","-","float","and","Decimal","instances","-","other","Rational","instances","(","including","integers",")"]
docstr: Helper for comparison operators, for internal use only.
  
  Implement comparison between a Rational instance `self`, and
  either another Rational instance or a float `other`.  If
  `other` is not a Rational instance or a float, return
  NotImplemented. `op` should be one of the six standard
  comparison operators.
code: def _richcmp(self, other, op):
      """Helper for comparison operators, for internal use only.
  
      Implement comparison between a Rational instance `self`, and
      either another Rational instance or a float `other`.  If
      `other` is not a Rational instance or a float, return
      NotImplemented. `op` should be one of the six standard
      comparison operators.
  
      """
      # convert other to a Rational instance where reasonable.
      if isinstance(other, numbers.Rational):
          return op(
              self._numerator * other.denominator,
              self._denominator * other.numerator,
          )
      if isinstance(other, float):
          if math.isnan(other) or math.isinf(other):
              return op(0.0, other)
          else:
              return op(self, self.from_float(other))
      else:
          return NotImplemented
  
imports: from decimal import Decimal
  import functools
  import math
  import numbers
  import operator
  import re
  import sys
label_desc: Use image node_id 35 for calling the Fraction obj's underlying member method code with example usage: obj._richcmp(other, op) and returns: op, NotImplemented, op, op