gh-116666: Add "token" glossary term (GH-130888)
Add glossary entry for `token`, and link to it.
Avoid talking about tokens in the SyntaxError intro (errors.rst); at this point
tokenization is too much of a technical detail. (Even to an advanced reader,
the fact that a *single* token is highlighted isn't too relevant. Also, we don't
need to guarantee that it's a single token.)
(cherry picked from commit 30d5205849)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Docs: make a tutorial example more precise (GH-125066)
Based on discussion here:
(cherry picked from commit 6e3c70c61b)
https: //discuss.python.org/t/omission-in-the-documentation/66816
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
Prefer "similar" over "equivalent" in tutorial (GH-125343)
In the datastructures tutorial doc, some operations are described as
"equivalent to" others. This has led to some user-confusion -- at
least in the Discourse forums -- about cases in which the operations
differ.
This change doesn't systematically eliminate the word "equivalent"
from the tutorial. It just substitutes "similar to" in several cases
in which "equivalent to" could mislead users into expecting exact
equivalence.
(cherry picked from commit 4a2282b067)
Co-authored-by: Stephen Rosen <sirosen@globus.org>
gh-85583: Add f-string index in tutorial/inputoutput.rst (GH-21681)
* bpo-41411 fstring index in tutorial/inputoutput
To assist in searching for fstrings I have added an index
* Add newline
---------
(cherry picked from commit a3443c0e22)
Co-authored-by: amaajemyfren <32741226+amaajemyfren@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
gh-125383: Update `fib` function comment for accuracy (GH-125386)
`Doc/tutorial/controlflow.rst`: fix comment for `fib` function
(cherry picked from commit 283ea5f3b2)
Co-authored-by: Wulian <xiguawulian@gmail.com>
Doc: Fix a typo in "Function Examples" in the control-flow tutorial (GH-125338)
(cherry picked from commit 5a074aab84)
Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Barry Warsaw <barry@python.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Docs: for for/else clarify that return or raise also skip the else (GH-124591)
(cherry picked from commit 5329d1b74a)
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
gh-122944: Fix incorrect prompt strings in the Python Tutorial (GH-122949)
In the REPL, top level comments are followed by a primary, not secondary prompt.
Fix the places in the in the tutorial that use the latter.
(cherry picked from commit be90648fb2)
Co-authored-by: Damien <81557462+Damien-Chen@users.noreply.github.com>
* Remove "()" when refer to a class as a type.
* Use :func: when refer to a callable.
* Fix reference to the datetime.astimezone() method.
(cherry picked from commit 92c9c6ae14)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Remove Python 3.5 hardcoded version in the tutorial appendix (GH-117612)
(cherry picked from commit a855f824a2)
Co-authored-by: Kerim Kabirov <the.privat33r+gh@pm.me>
There now may be multiple carets pointing at a token
rather than just a character. Fix the sentence about
possible causes.
(cherry picked from commit 3e45030076)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Kerim Kabirov <39376984+Privat33r-dev@users.noreply.github.com>
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
gh-114069: Revise Tutorial Methods paragraph (GH-114127)
Remove excess words in the first and third sentences.
(cherry picked from commit 31a2543c80)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Tutorial: Clarify 'nonzero exit status' in the appendix (GH-112039)
(cherry picked from commit 32f3684b8f)
Co-authored-by: Andrew Zipperer <47086307+zipperer@users.noreply.github.com>
gh-101100: Improve documentation for attributes on instance methods (GH-112832)
(cherry picked from commit ed21d0c1f4)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Use author link to 'The Perils of Floating Point'.
(cherry picked from commit c27b09c813)
Co-authored-by: Marco Aurélio A. Barbosa <aureliobarbosa@gmail.com>
gh-110534 fix a URL redirect to wikipedia article on Fibonacci numbers (GH-110535)
(cherry picked from commit 892ee72b36)
Co-authored-by: partev <petrosyan@gmail.com>
Update floatingpoint.rst (GH-110509)
This commit removes a ':'. I believe the extra colon causes a display error.
What I believe to be an error:
Above this expression
`round(math.pi, ndigits=2) == round(22 / 7, ndigits=2)`
the page displays `.. doctest::`.
What I observed:
After I remove the extra colon, the page does not display `.. doctest::`
(cherry picked from commit 8e56d551ce)
Co-authored-by: zipperer <47086307+zipperer@users.noreply.github.com>
gh-101100: Fix Sphinx warnings in `tutorial/controlflow.rst` (GH-109424)
(cherry picked from commit 8898a8683b)
Co-authored-by: Maciej Olko <maciej.olko@affirm.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Improve references in the tutorial (GH-108069)
* Use full qualified names for references (even if they do not work now,
they will work in future).
* Silence references to examples.
(cherry picked from commit 622ddc4167)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>