From 6082ebafd2df1fc0dc938045f2061554a19942e6 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 25 Aug 2024 17:56:48 -0700 Subject: [PATCH 1/2] src/doc/en/tutorial/afterword.rst: Remove remarks on Python 2 integers --- src/doc/en/tutorial/afterword.rst | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/doc/en/tutorial/afterword.rst b/src/doc/en/tutorial/afterword.rst index 84dd2891b71..4e26c729664 100644 --- a/src/doc/en/tutorial/afterword.rst +++ b/src/doc/en/tutorial/afterword.rst @@ -107,11 +107,9 @@ behaves differently from Python in several ways. 10 - **Integer division:** The Python expression ``2/3`` does not - behave the way mathematicians might expect. In Python2, if ``m`` and - ``n`` are ints, then ``m/n`` is also an int, namely the quotient of ``m`` - divided by ``n``. Therefore ``2/3=0``. In Python3, ``2/3`` returns the - floating point number ``0.6666...``. In both Python2 and Python3, ``//`` - is the Euclidean division and ``2//3`` returns ``0``. + behave the way mathematicians might expect: ``2/3`` returns the + floating point number ``0.6666...``. (Note that ``//`` + is the Euclidean division and ``2//3`` returns ``0``). We deal with this in the Sage interpreter, by wrapping integer literals in ``Integer( )`` and making division a constructor for rational @@ -125,16 +123,11 @@ behaves differently from Python in several ways. Rational Field sage: 2//3 0 - sage: int(2)/int(3) # not tested, python2 - 0 - **Long integers:** Python has native support for arbitrary precision integers, in addition to C-int's. These are significantly - slower than what GMP provides, and have the property that they - print with an ``L`` at the end to distinguish them from int's (and - this won't change any time soon). Sage implements arbitrary - precision integers using the GMP C-library, and these print without - an ``L``. + slower than what GMP provides. Sage implements arbitrary + precision integers using the GMP C-library. Rather than modifying the Python interpreter (as some people have From 73b011bc03ccfea432cba981690d8c04155becb4 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 25 Aug 2024 19:17:56 -0700 Subject: [PATCH 2/2] Remove parentheses --- src/doc/en/tutorial/afterword.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/doc/en/tutorial/afterword.rst b/src/doc/en/tutorial/afterword.rst index 4e26c729664..390e67bac07 100644 --- a/src/doc/en/tutorial/afterword.rst +++ b/src/doc/en/tutorial/afterword.rst @@ -108,8 +108,8 @@ behaves differently from Python in several ways. - **Integer division:** The Python expression ``2/3`` does not behave the way mathematicians might expect: ``2/3`` returns the - floating point number ``0.6666...``. (Note that ``//`` - is the Euclidean division and ``2//3`` returns ``0``). + floating point number ``0.6666...``. Note that ``//`` + is the Euclidean division and ``2//3`` returns ``0``. We deal with this in the Sage interpreter, by wrapping integer literals in ``Integer( )`` and making division a constructor for rational