pythonrational.py 548 B

12345678910111213141516171819202122
  1. """
  2. Rational number type based on Python integers.
  3. The PythonRational class from here has been moved to
  4. sympy.external.pythonmpq
  5. This module is just left here for backwards compatibility.
  6. """
  7. from sympy.core.numbers import Rational
  8. from sympy.core.sympify import _sympy_converter
  9. from sympy.utilities import public
  10. from sympy.external.pythonmpq import PythonMPQ
  11. PythonRational = public(PythonMPQ)
  12. def sympify_pythonrational(arg):
  13. return Rational(arg.numerator, arg.denominator)
  14. _sympy_converter[PythonRational] = sympify_pythonrational