Skip to content

Commit

Permalink
gh-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 #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 #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,
-->
<!-- - #12345: short description why this is a dependency -->
<!-- - #34567: ... -->
    
URL: #38563
Reported by: Matthias Köppe
Reviewer(s): Kwankyu Lee
  • Loading branch information
Release Manager committed Aug 27, 2024
2 parents 38705bf + 73b011b commit 9864710
Showing 1 changed file with 4 additions and 11 deletions.
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 9864710

Please sign in to comment.