parameters: (self, ndigits=None)
docstring: Will be round(self, ndigits) in 3.0.
  
          Rounds half toward even.
docstring_summary: Will be round(self, ndigits) in 3.0.
docstring_tokens: Will be round ( self ndigits ) in 3 . 0 .
function: def __round__(self, ndigits=None):
          """Will be round(self, ndigits) in 3.0.
  
          Rounds half toward even.
          """
          if ndigits is None:
              floor, remainder = divmod(self.numerator, self.denominator)
              if remainder * 2 < self.denominator:
                  return floor
              elif remainder * 2 > self.denominator:
                  return floor + 1
              # Deal with the half case:
              elif floor % 2 == 0:
                  return floor
              else:
                  return floor + 1
          shift = 10**abs(ndigits)
          # See _operator_fallbacks.forward to check that the results of
          # these operations will always be Fraction and therefore have
          # round().
          if ndigits > 0:
              return Fraction(round(self * shift), shift)
          else:
              return Fraction(round(self / shift) * shift)
function_tokens: def __round__ ( self , ndigits = None ) : if ndigits is None : floor , remainder = divmod ( self . numerator , self . denominator ) if remainder * 2 < self . denominator : return floor elif remainder * 2 > self . denominator : return floor + 1 # Deal with the half case: elif floor % 2 == 0 : return floor else : return floor + 1 shift = 10 ** abs ( ndigits ) # See _operator_fallbacks.forward to check that the results of # these operations will always be Fraction and therefore have # round(). if ndigits > 0 : return Fraction ( round ( self * shift ) , shift ) else : return Fraction ( round ( self / shift ) * shift )