Commit graph

1080 commits

Author SHA1 Message Date
Thanos
79c03ac001
gh-69686: Remove untrue part of __import__ replacement docs (#143261)
Remove untrue part of `__import__` replacement docs

The original statement effectively says that replacing `__import__` at global scope affects import statements, and not only that, but only import statements within the rest of the executing module. None of that has been true since at least Python 2.7, I think.

This was likely missed in python/cpython#69686.
2025-12-29 21:16:54 -08:00
Hugo van Kemenade
f1eb0c0b0c Python 3.15.0a3 2025-12-16 14:26:12 +02:00
SYan212
39ecb17103
typo fixes in docs (#142683) 2025-12-14 13:47:22 +05:30
dr-carlos
e5a48480c0
Add missing comma to tuple in except* docs (#142395) 2025-12-14 00:51:35 +02:00
Brett Cannon
af185727b2
GH-65961: Stop setting __cached__ on modules (GH-142165) 2025-12-11 11:44:46 -08:00
Brett Cannon
880a7905ca
GH-97850: Remove all uses and definitions of load_module() from importlib (#142205) 2025-12-10 15:35:51 -08:00
Serhiy Storchaka
1d8f3ed2eb
gh-101100: Fix references to the set methods (GH-141857) 2025-12-05 16:22:38 +02:00
Petr Viktorin
aea5531583
gh-135676: Reword the f-string (and t-string) section (GH-137469)
Much of the information was duplicated in stdtypes.rst; this PR keeps lexical/syntactical details in Lexical Analysis and the evaluation & runtime behaviour in Standard types, with cross-references between the two.
Since the t-string section only listed differences from f-strings, and the grammar for the two is equivalent, that section was moved to Standard types almost entirely.

Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-12-03 16:14:53 +01:00
Petr Viktorin
2ff8608b4d
gh-135676: Simplify docs on lexing names (GH-140464)
This simplifies the Lexical Analysis section on Names (but keeps it technically correct) by putting all the info about non-ASCII characters in a separate (and very technical) section.

It uses a mental model where the parser doesn't handle Unicode complexity “immediately”, but:

- parses any non-ASCII character (outside strings/comments) as part of a name, since these can't (yet) be e.g. operators
- normalizes the name
- validates the name, using the xid_start/xid_continue sets


Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Micha Albert <info@micha.zone>
Co-authored-by: KeithTheEE <kmurrayis@gmail.com>
2025-11-26 16:10:44 +01:00
Serhiy Storchaka
4bcab461c2
gh-41779: Allow defining the __dict__ and __weakref__ __slots__ for any class (GH-141755) 2025-11-19 17:11:37 +00:00
Ned Batchelder
237dca52ba
Docs: replace an esoteric Von Neumann mention (#137598)
* Docs: replace an esoteric Von Neumann mention

* oops, don't need to edit topics.py
2025-10-20 10:01:20 -04:00
Furkan Onder
faa169afa0
gh-66646: Explain __base__ attribute in the docs (GH-102554)
Co-authored-by: Éric <merwok@netwok.org>
2025-10-20 14:15:30 +02:00
Stan Ulbrych
1624c646b0
gh-140065: Lexical analysis: Correct note about leading zeros in floating point numbers (GH-140066) 2025-10-15 15:15:45 +00:00
Irit Katriel
fb25d6b35c
gh-97914: Reword misleading sentence on conditional expressions (#139064)
Co-authored-by: Gilles Peiffer <gilles.peiffer.yt@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-10-14 11:21:13 +03:00
Petr Viktorin
59a6f9d8c5
gh-135676: Add a summary of source characters (GH-138194)
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Micha Albert <info@micha.zone>
Co-authored-by: KeithTheEE <kmurrayis@gmail.com>
2025-10-08 16:34:19 +02:00
Adam Turner
3195da0b1a
gh-105812: Use the `:deco:` role in place of manual decorator markup (#139619) 2025-10-05 21:15:36 +01:00
Eric Snow
46a1f0a9ff
gh-135944: Add a "Runtime Components" Section to the Execution Model Docs (gh-135945)
The section provides a brief overview of the Python runtime's execution environment.  It is meant to be implementation agnostic,
2025-10-02 09:13:22 -06:00
sobolevn
848d926786
Make sure the `:keyword: role works for case` (#138878) 2025-09-21 11:49:49 +01:00
Irit Katriel
a651ec9524
gh-135629: rewrite language reference section on except* to improve clarity (#136150) 2025-09-16 13:56:51 +01:00
Kian Eliasi
481588ad4c
gh-138871: Clarify NameError exception in 'del' (#138881) 2025-09-15 02:11:01 -04:00
Benjamin Peterson
5bd4bf04c4
closes gh-138706: update Unicode to 17.0.0 (#138719) 2025-09-11 09:58:39 -07:00
Adam Turner
d0c9943869
GH-138562: Remove `sort()` from the common sequence methods in the data model (#138563) 2025-09-10 15:52:57 +00:00
Adam Turner
22cb9ba8f9
GH-101100: Remove some entries from `nitpick_ignore` (#138464) 2025-09-08 22:10:26 +00:00
Adam Turner
6831634eb7
gh-101100: Resolve reference warnings in reference/ (#138418) 2025-09-08 19:31:24 +00:00
Adam Turner
8ed1d53e62
GH-138465: Improve documentation for common sequence methods (#138474)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-09-05 20:55:02 +01:00
dbXD320
e5c5830079
gh-138191: Document `frame.f_generator` in the data model (#138540)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-09-05 17:07:29 +00:00
Petr Viktorin
cfcfbdd923
gh-135676: Reword the Operators & Delimiters section(s) (GH-137713)
Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-09-03 15:29:15 +00:00
Adam Turner
6d730b1183
GH-101100: Resolve reference warnings in whatsnew/3.6.rst (#138411)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-09-03 16:22:17 +01:00
Adam Turner
dd86fb4ba5
GH-101100: Resolve reference warnings in whatsnew/3.7.rst (#138410)
Resolve reference warnings in whatsnew/3.7.rst
2025-09-03 09:20:16 +03:00
James Parrott
8d5c3341c5
gh-138297 Point link in docs for finally to try/else, instead of if/else (#138298)
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-09-02 14:56:23 +00:00
Stan Ulbrych
0a0cbd43a7
gh-110936: Reorder string literal definition in Lexical Analysis (GH-138063) 2025-09-02 13:48:26 +02:00
Petr Viktorin
9f05f98730
gh-137376: Add note on top-level global declarations (GH-137707)
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
2025-08-21 14:58:38 +02:00
Greg Stein
c653fba016
Docs: Small clarity change for `except*` (#121073)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-08-06 21:58:24 +00:00
Adam Turner
4dae9b1ff1
gh-132661: PEP 750 documentation: second pass (#137020) 2025-08-04 22:45:51 +01:00
Jelle Zijlstra
11503211c6
gh-136843: Document how multiple inheritance works (#136844)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2025-07-28 12:35:40 -07:00
Petr Viktorin
777159fa31
gh-135676: Lexical analysis: Reword String literals and related sections (GH-135942)
Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-07-23 15:57:54 +00:00
Dave Peck
22c8658906
gh-132661: Document t-strings and templatelib (#135229)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Loïc Simon <loic.pano@gmail.com>
Co-authored-by: pauleveritt <pauleveritt@me.com>
2025-07-22 12:44:13 +03:00
Connor Denihan
0d76dccc3b
gh-135110: Fix misleading generator.close() documentation (GH-135152)
The documentation incorrectly stated that generator.close() 'raises' a
GeneratorExit exception. This was misleading because the method doesn't
raise the exception to the caller - it sends the exception internally
to the generator and returns None.
2025-06-26 09:27:25 -04:00
HarryLHW
d2154912b3
Docs: Add cross-reference for positional_item in the calls productionlist (GH-129977)
Add missing hyperlink for `positional_item`
2025-06-25 10:24:58 -04:00
Petr Viktorin
21f3d15534
gh-135676: lexical analysis: Improve section on Numeric literals (GH-134850) 2025-06-18 16:34:18 +02:00
Serhiy Storchaka
8979d3afe3
gh-135171: Update documentation for the generator expression (GH-135351)
* gh-135171: Update documentation for the generator expression

Document that the iterator for the leftmost "for" clause is created
immediately.

* Update Doc/reference/expressions.rst

Co-authored-by: Brian Skinn <brian.skinn@gmail.com>

---------

Co-authored-by: Brian Skinn <brian.skinn@gmail.com>
2025-06-14 17:32:44 -07:00
Petr Viktorin
28d91d06f1
gh-127833: Reword and expand the Notation section (GH-134443)
Prepare the docs for using the notation used in the `python.gram`
file. If we want to sync the two, the meta-syntax should be the same.

Link the Full Grammar docs here; keep only a few extras.

Also, remove the distinction between lexical and syntactic rules,
except for whitespace handling.
With f- and t-strings, the line between the two is blurry.

Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Colin Marquardt <cmarqu42@gmail.com>
2025-06-09 15:50:11 +02:00
Eric V. Smith
08c78e02fa
gh-134675: Add t-string prefixes to tokenizer module, lexical analysis doc, and add a test to make sure we catch this error in the future. (#134734)
* Add t-string prefixes to _all_string_prefixes, and add a test to make sure we catch this error in the future.

* Update lexical analysis docs for t-string prefixes.
2025-05-26 13:49:39 -04:00
Jelle Zijlstra
7291eaba8b
gh-119180: Updates to PEP 649/749 docs (#134640)
- Mention (again) that `type.__annotations__` is unsafe. It is now safe
  when using only classes defined under PEP 649 semantics, but not with
  classes defined using `from __future__ import annotations`.
- Mention that annotations on instances no longer work. There was already
  an issue about this.
- Mention the general changes in the "Porting to Python 3.14" section.
- `annotationlib` was proposed by PEP-749, not PEP-649.

Co-authored-by: Emma Smith <emma@emmatyping.dev>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2025-05-26 08:35:04 -07:00
Yash Vijay
4eacf3883d
gh-134026: Fix grammar description of for statement (GH-134034) 2025-05-21 16:09:28 +02:00
Petr Viktorin
c7364f79b2
gh-127833: lexical analysis: Improve section on Names (GH-131474)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Blaise Pabon <blaise@gmail.com>
2025-05-21 16:01:52 +02:00
Jelle Zijlstra
3396df56d0
gh-119180: More documentation for PEP 649/749 (#133552)
The SC asked that the Appendix in PEP-749 be added to the docs.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-11 08:43:17 -07:00
Petr Viktorin
45bb5ba61a
gh-127833: Add links to token types to the lexical analysis intro (#131468)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-05-08 09:38:29 +00:00
Stan Ulbrych
0552ce0fb2
gh-127833: lexical analysis: Add backticks to BOM example (#132407) 2025-05-08 02:34:48 +01:00
Hugo van Kemenade
b092705907 Python 3.14.0b1 2025-05-06 18:33:52 +03:00