Commit Graph

810 Commits

Author SHA1 Message Date
Miss Islington (bot) 2572c670d4
[3.10] bpo-23556: [doc] Fix inaccuracy in documentation for raise without args. Improve tests for context in nested except handlers. (GH-29236) (GH-30953)
(cherry picked from commit 08c0ed2d9c)


Co-authored-by: Kinshuk Dua <kinshukdua@gmail.com>

Automerge-Triggered-By: GH:iritkatriel
2022-01-27 02:51:06 -08:00
Miss Islington (bot) 75a1865d1c
[3.10] bpo-24650: Use full term "generator function" in yield expressions docs (GH-24663) (GH-30461)
(cherry picked from commit 273cb8e757)


Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>

Automerge-Triggered-By: GH:iritkatriel
2022-01-07 11:01:33 -08:00
Miss Islington (bot) e9783d6434
bpo-46095: Improve SeqIter documentation. (GH-30316) (GH-30330) 2022-01-01 11:12:43 -08:00
Miss Islington (bot) d7537ac8e3
bpo-46076: Improve documentation for per-attribute docstrings with `__slots__` (GH-30109) (GH-30206) 2021-12-19 15:11:12 -06:00
Alex Waygood 7da90251ae
bpo-45840: Improve cross-references in the data model documentation (GH-29633) (GH-30077)
(cherry picked from commit c0521fe49f)
2021-12-13 11:20:21 +02:00
Miss Islington (bot) 4b224e8729
[doc] Clarify MRO precedence in descriptor super binding section (GH-29539) (GH-29669)
A similar sentence is present in the 'Invocation from super' section of
the descriptor HOWTO, where it is already correct.
(cherry picked from commit ee49484c0f)

Co-authored-by: Jouke Witteveen <j.witteveen@gmail.com>
2021-12-11 01:01:16 +01:00
Miss Islington (bot) 7842aed7a7
bpo-45619: documentation of execution model: clarify and update binding summary (GH-29232)
This does two changes that are quite related.

0. it add that variable binding can occur in pattern matching, an update of 3.10
which seems to have been omitted from the list of bindings
1. Given how long the sentence already was, with even subcases in the middle of
the sentence, the commit breaks the sentence into an actual list.
(cherry picked from commit cd876c8493)

Co-authored-by: Arthur Milchior <arthur@milchior.fr>
2021-11-25 21:36:37 -08:00
Brett Cannon 99aad31b7a
[3.10] bpo-45250: fix docs regarding `__iter__` and iterators being inconsistently required by CPython (GH-29170) (GH-29650)
It is now considered a historical accident that e.g. `for` loops and the `iter()` built-in function do not require the iterators they work with to define `__iter__`, only `__next__`.
(cherry picked from commit be36e06340)

Co-authored-by: Brett Cannon <brett@python.org>
2021-11-22 15:09:15 -08:00
Miss Islington (bot) fde9f61e70
[3.10] [doc] bpo-45680: Disambiguate ``__getitem__`` and ``__class_getitem__`` in the data model (GH-29389) (GH-29620)
The documentation explaining Python's data model does not adequately explain
the differences between ``__getitem__`` and ``__class_getitem__``, nor does it
explain when each is called. There is an attempt at explaining
``__class_getitem__`` in the documentation for ``GenericAlias`` objects, but
this does not give sufficient clarity into how the method works. Moreover, it
is the wrong place for that information to be found; the explanation of
``__class_getitem__`` should be in the documentation explaining the data model.

This PR has been split off from GH-29335.
(cherry picked from commit 31b3a70edb)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-11-18 18:34:08 +01:00
Miss Islington (bot) 252d83cbf1
bpo-45640: [docs] Tokens are now clickable (GH-29260) (GH-29621)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 32959108f9)

Co-authored-by: Arthur Milchior <arthur@milchior.fr>
2021-11-18 17:28:39 +01:00
Miss Islington (bot) fef54abf5f
bpo-45583: Correct datamodel documentation of int() (GH-29182) (GH-29285)
It should be noted that this part of the documentation is redundant with
function.rst's documentation of int. This one was correctly updated with Python 3.8.
(cherry picked from commit d9c1868c25)

Co-authored-by: Arthur Milchior <arthur@milchior.fr>
2021-10-28 22:17:06 +02:00
Miss Islington (bot) 855d6247ad
[3.10]bpo-45463: Clarify that global statements allows multiple names (GH-28851) (GH-28989)
The global statement allows specifying a list of identifiers
(https://docs.python.org/3/reference/simple_stmts.htmlGH-the-global-statement).

The "Execution model" chapter described the global statement as if it
only allowed one single name. Pluralize "name" in the appropriate places.
(cherry picked from commit 4ecd119b00)

Co-authored-by: Luca Chiodini <luca@chiodini.org>

Co-authored-by: Luca Chiodini <luca@chiodini.org>
2021-10-16 10:01:54 -04:00
Miss Islington (bot) 5abb2dec2c
[docs] lexical_analysis: Expand the text on ``_`` (GH-28903) (GH-28933)
Also:
* Expand the discussion into its own entry. (Even before this,
  text on ``_`` was longet than the text on ``_*``.)

* Briefly note the other common convention for `_`: naming unused
  variables.

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 3dee0cb621)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2021-10-13 18:58:06 +02:00
Miss Islington (bot) 3c27013077
Fix class pattern docs to refer to class patterns (GH-28849)
(cherry picked from commit 0bcc5ade9b)

Co-authored-by: Christophe Nanteuil <35002064+christopheNan@users.noreply.github.com>
2021-10-10 07:35:23 -07:00
Miss Islington (bot) 72089f33c0
bpo-45346: Keep docs consistent regarding true and false values (GH-28697) (GH-28698) 2021-10-02 14:32:56 -05:00
Łukasz Langa 8f9d398b46
[3.10] [docs] Improve the markup of powers (GH-28598) (GH-28607)
(cherry picked from commit 4f05f15d7b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-09-28 23:09:58 +02:00
Łukasz Langa 8c1e1da565
[3.10] [codemod] Fix non-matching bracket pairs (GH-28473) (GH-28511)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 8f943ca257)

Co-authored-by: Mohamad Mansour <66031317+mohamadmansourX@users.noreply.github.com>
2021-09-22 01:33:59 +02:00
Miss Islington (bot) 7ab114bf1f
bpo-45198: __set_name__ documentation not clear about its usage with non-descriptor classes (GH-28439)
(cherry picked from commit 94b462686b)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2021-09-18 00:10:00 -07:00
Miss Islington (bot) b045174a6d
bpo-44964: Correct the note about the f_lasti field (GH-28208) (GH-28276)
(cherry picked from commit ab327f2929)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-09-10 18:16:51 +02:00
Miss Islington (bot) ef70413777
bpo-45104: Clarify when __init__ is called (GH-28210)
(cherry picked from commit fa15df77f0)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2021-09-07 09:26:35 -07:00
Miss Islington (bot) fc840736e5
bpo-44964: Add a note explaining the new semantics of f_last_i in frame objects (GH-28200)
(cherry picked from commit fa2c0b85a8)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-09-07 04:36:43 -07:00
Miss Islington (bot) ea39933b4b
bpo-45003: Change __div__ to __truediv__ in py3 language reference. (GH-27951) (GH-27963)
(cherry picked from commit 806e25fd31)

Co-authored-by: Objectivitix <79152594+Objectivitix@users.noreply.github.com>
2021-08-26 10:04:05 +03:00
Miss Islington (bot) ec5a03168f
bpo-39452: Rewrite and expand __main__.rst (GH-26883)
Broadened scope of the document to explicitly discuss and differentiate between ``__main__.py`` in packages versus the ``__name__ == '__main__'`` expression (and the idioms that surround it), as well as ``import __main__``.

Co-authored-by: Géry Ogam <gery.ogam@gmail.com>
Co-authored-by: Éric Araujo <merwok@netwok.org>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 7cba23164c)

Co-authored-by: Jack DeVries <58614260+jdevries3133@users.noreply.github.com>
2021-08-24 13:54:08 -07:00
Miss Islington (bot) 843b3d2820
bpo-41911: Update docs for various expressions (GH-27470) (GH-27490)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 4bd9caafb6)

Co-authored-by: andrei kulakov <andrei.avk@gmail.com>
2021-07-30 19:25:45 +02:00
Miss Islington (bot) 016af14d93
[3.10] bpo-44589: raise a SyntaxError when mapping patterns have duplicate literal keys (GH-27131) (GH-27157)
(cherry picked from commit 2693132292)


Co-authored-by: Jack DeVries <58614260+jdevries3133@users.noreply.github.com>

Automerge-Triggered-By: GH:brandtbucher
2021-07-14 18:00:35 -07:00
Miss Islington (bot) 8940916a02
Update doc as relative import can be used with star import (GH-25667) (GH-26121)
(cherry picked from commit 3d4b5f1019)

Co-authored-by: Saiyang Gou <gousaiyang@163.com>

Co-authored-by: Saiyang Gou <gousaiyang@163.com>
2021-05-14 07:26:40 -07:00
Miss Islington (bot) e7d25d3f3b
bpo-43977: Update pattern matching language reference docs (GH-25917) (GH-26117)
* Update patma language reference with new changes to sequence and mapping

* update 3.10 whatsnew too
(cherry picked from commit 53c91ac525)

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2021-05-13 22:55:41 -07:00
Miss Islington (bot) ae4f857499
bpo-44025: Clarify when '_' is a keyword. (GH-25873)
In match statements, in case patterns and nowhere else.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit 3b200b2aa6)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2021-05-04 04:36:50 -07:00
Zackery Spytz 7d2b83e9f0
bpo-43990: Fix the footnote ordering in the operator precedence docs (GH-25805)
Footnotes 5 and 6 were in the wrong order.
2021-05-02 10:29:15 -07:00
larryhastings 49b26fa517
bpo-43987: Add "Annotations Best Practices" HOWTO doc. (#25746)
Add "Annotations Best Practices" HOWTO doc.
2021-05-01 21:19:24 -07:00
Ryan Hileman 9a2c2a9ec3
bpo-42800: add audit hooks for f_code and tb_frame (GH-24182)
Accessing the following attributes will now fire PEP 578 style audit hooks as ("object.__getattr__", obj, name):
* PyTracebackObject: tb_frame
* PyFrameObject: f_code
* PyGenObject: gi_code, gi_frame
* PyCoroObject: cr_code, cr_frame
* PyAsyncGenObject: ag_code, ag_frame
Add an AUDIT_READ attribute flag aliased to READ_RESTRICTED.
Update obsolete flag documentation.
2021-04-30 00:15:55 +01:00
Géry Ogam a1a5e3c4c8
Fix a typo in datamodel reference document (GH-24930) 2021-04-25 14:13:19 -07:00
Pablo Galindo b0544ba77c
bpo-38605: Revert making 'from __future__ import annotations' the default (GH-25490)
This reverts commits 044a1048ca and 1be456ae9d, adapting the code to changes that happened after it.
2021-04-21 12:41:19 +01:00
Ammar Askar 68ba0c67ca
bpo-43837: Reverse order of precedence table to show tightly binding operators first (GH-25469) 2021-04-19 08:22:03 -07:00
Ken Jin 37a5e22023
Use double quotes over single quotes for match statement grammar (GH-24943) 2021-04-12 10:03:20 -07:00
Victor Stinner 553ee2781a
bpo-43682: Make staticmethod objects callable (GH-25117)
Static methods (@staticmethod) are now callable as regular functions.
2021-04-12 00:21:22 +02:00
Mark Dickinson 79650d0118
Fix description of behaviour of an exception class in 'from' clause (GH-24303) 2021-04-11 09:33:59 +01:00
Saiyang Gou 1e051a21b7
bpo-39702: Remove dotted_name from decorator documentation (GH-25234) 2021-04-08 15:34:09 -07:00
Saiyang Gou 58d72cab89
bpo-36540: Improve doc of function definition regarding positional-only arguments (GH-25235) 2021-04-07 20:06:43 +01:00
Saiyang Gou 1be456ae9d
bpo-38605: Update "Future statements" docs since PEP 563 is always enabled (GH-25236)
Update documentation section for "Future statements" to reflect that `from __future__ import annotations` is on by default, and no features require using the future statement now.
2021-04-06 22:02:20 -07:00
Saiyang Gou 0fdf11e8e9
bpo-43755: Update docs to reflect that lambda is not allowed in `comp_if` since 3.9 (GH-25231) 2021-04-06 23:15:37 +01:00
Ken Jin 5143fd15b4
Update pattern matching docs for changes to the PEP (#25185)
See:
- https://github.com/python/peps/pull/1909 (__match_args__ must be a tuple)
- https://github.com/python/peps/pull/1908 (allow keyword patterns for int(x) etc.)
2021-04-06 09:03:00 -07:00
Brett Cannon f97dc80068
bpo-43672: raise ImportWarning when calling find_loader() (GH-25119) 2021-04-02 12:35:32 -07:00
Brett Cannon a7ff6df60c
bpo-42134: Raise ImportWarning when calling find_module() in the import system (GH-25044) 2021-03-30 08:43:03 -07:00
Brett Cannon 1899087b21
bpo-42136: Deprecate module_repr() as found in importlib (GH-25022) 2021-03-26 11:55:07 -07:00
Daniel F Moisset a22bca6b1e
bpo-42128: Add documentation for pattern matching (PEP 634) (#24664)
This is a first edition, ready to go out with the implementation. We'll iterate during the rest of the period leading up to 3.10.0.

Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Co-authored-by: Fidget-Spinner <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: Brandt Bucher <brandt@python.org>
Co-authored-by: Raymond Hettinger <1623689+rhettinger@users.noreply.github.com>
Co-authored-by: Guido van Rossum <guido@python.org>
2021-02-28 20:08:38 -08:00
Terry Jan Reedy 2f9ef514fb
bpo-27646: Say that 'yield from' expression can be any iterable (GH-24595)
Previously, the doc at least strongly implied that it had to be an iterator.
2021-02-20 21:33:25 -05:00
Ken Jin 2edaf6a4fb
bpo-8264: Document hasattr and getattr behavior for private attributes (GH-23513)
Clarify ``getattr`` and ``setattr`` requirements for accessing name-mangled attributes

Co-Authored-By: Catalin Iacob <iacobcatalin@gmail.com>
2021-02-02 13:06:57 -08:00
Pablo Galindo 7c8e0b0336
Document new parenthesized with statements (GH-24281) 2021-01-25 23:15:51 +00:00
Géry Ogam d515c610c6
bpo-35790: Correct the description of sys.exc_info() and add a code example (GH-11625) 2020-12-21 14:13:08 +01:00