summaryrefslogtreecommitdiffstats
path: root/Doc/reference
Commit message (Collapse)AuthorAgeFilesLines
* gh-60712: Include the "object" type in the lists of documented types (GH-103036)Furkan Onder2024-10-301-15/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * add test for the predefined object's attributes * Include the "object" type in the lists of documented types * remove 'or' from augment tuple * 📜🤖 Added by blurb_it. * Add cross-reference to news Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> * Fix format for the function parameter Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> * Add space Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> * add reference for the 'object' Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> * add reference for NotImplemented Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> * Change ref:`string <textseq>` as class:`str` Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> * remove hyphen from `newly-created` * Update Doc/reference/datamodel.rst 'dictionaries' to 'dict' Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> * Update predefined attribute types in testPredefinedAttrs * Change `universal type` as `top type` * Don't mention about the top type * Update the description of richcmpfuncs * Update Doc/library/stdtypes.rst Co-authored-by: Éric <merwok@netwok.org> * Revert: Hierarchy Section in Data Model Documentation * Revert to original explanations of __new__ and __init__ methods in datamodel.rst for improved clarity. * Update Doc/reference/datamodel.rst Co-authored-by: Éric <merwok@netwok.org> * Remove blank line Co-authored-by: Éric <merwok@netwok.org> * Use ref:`str <textseq>` instead of :class:`str Co-authored-by: Éric <merwok@netwok.org> * Revert changes the description of Other Built-in Types in stdtypes.rst * Update Doc/reference/datamodel.rst Co-authored-by: Éric <merwok@netwok.org> --------- Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> Co-authored-by: Éric <merwok@netwok.org> Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
* gh-126072: do not add `None` to `co_consts` if there is no docstring (GH-126101)Xuanteng Huang2024-10-301-3/+3
|
* bpo-41793: Fix an inaccuracy about reflected methods in datamodel docs ↵Wim Jeantine-Glenn2024-10-291-11/+14
| | | | | | | (GH-22257) * Qualifying that the right operand's type must be a *strict* subclass for the reflected method to take precedence avoids an edge case / counter-example when the types are actually equal. Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
* gh-125461: Remove Python 2 from identifiers in doc (GH-125462)Paul Hoffman2024-10-141-3/+2
| | | Remove Python 2 from identifiers in doc
* gh-101100: Consolidate documentation on `ModuleType` attributes (#124709)Alex Waygood2024-10-092-177/+248
| | | | | | 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>
* gh-70870: Clarify dual usage of 'free variable' (#122545)Alyssa Coghlan2024-10-082-5/+13
| | | | | | | | | | | | | | The term "free variable" has unfortunately become genuinely ambiguous over the years (presumably due to the names of some relevant code object instance attributes). While we can't eliminate that ambiguity at this late date, we can at least alert people to the potential ambiguity by describing both the formal meaning of the term and the common alternative use as a direct synonym for "closure variable". --------- Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
* gh-125072: Add label for assignment expressions; update tracked section for ↵Emily Morehouse2024-10-071-0/+2
| | | | assignment expression topic (#125074)
* gh-123339: Fix cases of inconsistency of __module__ and __firstlineno__ in ↵Serhiy Storchaka2024-09-281-1/+4
| | | | | | | | | | | | | classes (GH-123613) * Setting the __module__ attribute for a class now removes the __firstlineno__ item from the type's dict. * The _collections_abc and _pydecimal modules now completely replace the collections.abc and decimal modules after importing them. This allows to get the source of classes and functions defined in these modules. * inspect.findsource() now checks whether the first line number for a class is out of bound.
* gh-81263: Add assignment expressions to `help` (#124641)Emily Morehouse2024-09-271-0/+1
| | | | | * Add assignment expression (:=) to `help` * Update index for Assignment Expressions to include pair of `assignment; expression`
* gh-115528: Update language reference for PEP 646 (#121181)Matthew Rahtz2024-09-262-17/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To recap: the objective is to make starred expressions valid in `subscription`, which is used for generics: `Generic[...]`, `list[...]`, etc. What _is_ gramatically valid in such contexts? Seemingly any of the following. (At least, none of the following throw `SyntaxError` in a 3.12.3 REPL.) Generic[x] Generic[*x] Generic[*x, y] Generic[y, *x] Generic[x := 1] Generic[x := 1, y := 2] So introducting flexible_expression: expression | assignment_expression | starred_item end then switching `subscription` to use `flexible_expression` sorts that. But then we need to field `yield` - for which any of the following are apparently valid: yield x yield x, yield x, y yield *x, yield *x, *y Introducing a separate `yield_list` is the simplest way I've been figure out to do this - separating out the special case of `starred_item ,`. Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-101100: Make __subclasses__ doctest stable (#124577)Jelle Zijlstra2024-09-261-2/+4
| | | | | Using a standard library class makes this test difficult to maintain as other tests and other parts of the stdlib may create subclasses, which may still be alive when this test runs depending on GC timing.
* gh-123242: Note that type.__annotations__ may not exist (#124557)Jelle Zijlstra2024-09-251-1/+2
| | | | | Closes #123242. The real criterion is that the attribute does not exist on heap types, but I don't think we should discuss heap vs. static types in the language reference.
* gh-124370: Add "howto" for free-threaded Python (#124371)Sam Gross2024-09-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * gh-124370: Add "howto" for free-threaded Python This is a guide aimed at people writing Python code, as oppposed to the existing guide for C API extension authors. * Add missing new line * Update Doc/howto/free-threading-python.rst Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> * interned -> immortalized * Apply suggestions from code review Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> * Update Doc/howto/free-threading-python.rst Co-authored-by: mpage <mpage@cs.stanford.edu> * Update docs * Apply suggestions from code review Co-authored-by: Carol Willing <carolcode@willingconsulting.com> * A few more updates * Additional comment on immortal objects * Mention specializing adaptive interpreter * Remove trailing whitespace * Remove mention of C macro --------- Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: mpage <mpage@cs.stanford.edu> Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
* gh-101100: Add a table of class attributes to the "Custom classes" section ↵Alex Waygood2024-09-254-66/+129
| | | | of the data model docs (#124480)
* import: permit __name__ for use in __name__ = "__main__": (#124381)Thomas Grainger2024-09-251-1/+1
| | | permit __name__ for use in __name__ = "__main__":
* GH-65961: Document the deprecation of `__package__` and `__cached__` (GH-124377)Brett Cannon2024-09-231-0/+8
| | | The code changes for warning related to `__package__` landed in Python 3.12. `__cached__` doesn't have any changes as it isn't used but only set by the import system.
* GH-103484: Fix permanently redirects reported by linkcheck (GH-124144)Rafael Fontenelle2024-09-171-1/+1
| | | Fix redirects reported by linkcheck, update docs conf.py checks.
* closes gh-124016: update Unicode to 16.0.0 (#124017)Benjamin Peterson2024-09-131-4/+4
|
* gh-119180: Documentation for PEP 649 and 749 (#122235)Jelle Zijlstra2024-09-114-33/+166
| | | | | Co-authored-by: Bénédikt Tran <10796600+picnixz@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-123621: Fix `datamodel.rst` with proper `dict` notation (#123648)Lipták Attila (Flash)2024-09-031-1/+1
|
* gh-123579: Document exclamation token (#123612)Shaygan Hooshyari2024-09-031-3/+3
|
* gh-123580: Fix `signed_number` token in documentation (GH-123582)CBerJun2024-09-031-1/+1
| | | Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
* gh-123517: Remove unnecessary ``:meth:`` parentheses (#123518)Wei-Hsiang (Matt) Wang2024-09-012-3/+3
|
* gh-123492: Remove unnecessary `:func:` parentheses (#123493)Wei-Hsiang (Matt) Wang2024-08-301-1/+1
|
* gh-122701: Fix wording of raw strings/bytes in `lexical_analysis.rst` (#122702)sobolevn2024-08-111-5/+4
| | | Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
* gh-122511: Improve documentation for object identity of mutable/immutable ↵Bénédikt Tran2024-08-071-6/+10
| | | | | types (#122512) Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
* gh-122445: populate only modified fields in __static_attributes__ (#122446)Irit Katriel2024-08-021-1/+1
|
* Remove outdated note about instance methods from datamodel.rst (#122471)Thomas Grainger2024-07-301-8/+1
|
* gh-121905: Consistently use "floating-point" instead of "floating point" ↵Serhiy Storchaka2024-07-193-21/+21
| | | | (GH-121907)
* gh-120452: improve documentation about private name mangling (#120451)Bénédikt Tran2024-07-131-11/+40
| | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-121355: Fix incorrect word in simple_stmts.rst (#121356)Jongbum Won2024-07-041-1/+1
|
* gh-114104: clarify asynchronous comprehension docs to match runtime behavior ↵Danny Yang2024-07-011-4/+6
| | | | (#121175)
* gh-120937: Reference weakref from the `__del__` documentation (#120940)chaen2024-06-261-0/+2
| | | Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
* gh-120521: clarify except* documentation to allow tuples (#120523)Danny Yang2024-06-191-9/+10
| | | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
* annotations: expand documentation on "simple" assignment targets (#120535)Jelle Zijlstra2024-06-151-2/+5
| | | | | This behavior is rather surprising and it was not clearly specified. Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* doc: Mention the missing reflected special methods for all binary operations ↵Paulo Freitas2024-06-041-7/+17
| | | | (GH-119931)
* gh-119740: Remove deprecated trunc delegation (#119743)Mark Dickinson2024-06-021-5/+2
| | | | | | | | Remove the delegation of `int` to the `__trunc__` special method: `int` will now only delegate to `__int__` and `__index__` (in that order). `__trunc__` continues to exist, but its sole purpose is to support `math.trunc`. --------- Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-118934: Fix PyEval_GetLocals docs (PEP 667) (#119932)Alyssa Coghlan2024-06-021-2/+2
| | | | | | | | | | | | | PEP 667's description of the planned changes to PyEval_GetLocals was internally inconsistent when accepted, so the docs added for gh-74929 didn't match either the current behaviour or the intended behaviour once gh-118934 is fixed. This PR updates the documentation and 3.13 What's New to match the intended behaviour (once gh-118934 is fixed). It also tidies up lingering references to `f_locals` always being a dictionary (this hasn't been true since at least when custom namespace support for class statement execution was added)
* gh-100117: Fix inaccuracy in documentation of the CodeObject's co_positions ↵Irit Katriel2024-05-311-1/+1
| | | | field. (#119364)
* gh-74929: PEP 667 general docs update (gh-119201)Alyssa Coghlan2024-05-211-1/+1
| | | | | | | | * expand on What's New entry for PEP 667 (including porting notes) * define 'optimized scope' as a glossary term * cover comprehensions and generator expressions in locals() docs * review all mentions of "locals" in documentation (updating if needed) * review all mentions of "f_locals" in documentation (updating if needed)
* gh-118767: Improve tests and docs for bool(NotImplemented) (#118813)Jelle Zijlstra2024-05-091-3/+3
|
* gh-118767: Make bool(NotImplemented) raise TypeError (#118775)Jelle Zijlstra2024-05-081-0/+3
|
* gh-118465: Add __firstlineno__ attribute to class (GH-118475)Serhiy Storchaka2024-05-061-0/+4
| | | | It is set by compiler with the line number of the first line of the class definition.
* gh-74929: Rudimentary docs for PEP 667 (#118581)Guido van Rossum2024-05-051-1/+6
| | | | | | | | | This is *not* sufficient for the final 3.13 release, but it will do for beta 1: - What's new entry - Updated changelog entry (news blurb) - Mention the proxy for f_globals in the datamodel and Python frame object docs This doesn't have any C API details (what's new refers to the PEP).
* gh-116126: Implement PEP 696 (#116129)Jelle Zijlstra2024-05-032-10/+29
| | | | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
* Clarifying nonlocal doc: SyntaxError is raised if nearest enclosing scope is ↵Quazi Irfan2024-04-211-2/+3
| | | | | global (#114009) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-115775: Add whatsnew entry about __static_attributes__ (GH-117909)Irit Katriel2024-04-191-0/+5
| | | | | Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru> Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* Add 'The Python 2.3 Method Resolution Order' (#116435)Hugo van Kemenade2024-04-151-5/+2
|
* Add information about negative indexes to sequence datamodel doc (#110903)Adorilson Bezerra2024-03-251-3/+6
| | | Co-authored by Terry Jan Reedy
* gh-56374: Clarify documentation of nonlocal (#116942)Terry Jan Reedy2024-03-191-13/+17
| | | | | Define 'nonlocal scopes' in a way that excludes class scopes. Rearrange the rest of the doc. Add "Programmer's note".