Skip to content

Commit

Permalink
sagemathgh-38563: Tutorial: Remove remarks on Python 2 integers
Browse files Browse the repository at this point in the history
<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [ ] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->

URL: sagemath#38563
Reported by: Matthias Köppe
Reviewer(s): Kwankyu Lee
  • Loading branch information
Release Manager committed Aug 27, 2024
2 parents b168174 + 73b011b commit 3750a7b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
4 changes: 2 additions & 2 deletions build/pkgs/configure/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
tarball=configure-VERSION.tar.gz
sha1=e162e0f52da5eca0c01ddf4831edcea1acd72033
sha256=2033521228294e134368d69457d6e582706e84ff10bf3d6d0a57a2a4afad0a8b
sha1=c5a690b2f18f494343af073afd671f4a3de15f67
sha256=a8471f7b347e18f9b85298a475fe6c5653d6cfa528b4e47f392f6e21c78628c9
2 changes: 1 addition & 1 deletion build/pkgs/configure/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b178c10a7401b381b8ed2daab5aaf026436452c9
f89675ff33c44c10ee50de55a94f7125104d7967
15 changes: 4 additions & 11 deletions src/doc/en/tutorial/afterword.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,8 @@ 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, ``//``
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
Expand All @@ -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
Expand Down

0 comments on commit 3750a7b

Please sign in to comment.