Emily Morehouse
626668912f
gh-81263: Add assignment expressions to `help` ( #124641 )
...
* Add assignment expression (:=) to `help`
* Update index for Assignment Expressions to include pair of `assignment; expression`
2024-09-27 13:59:26 -07:00
Matthew Rahtz
7d3497f617
gh-115528: Update language reference for PEP 646 ( #121181 )
...
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>
2024-09-26 12:35:17 -07:00
Alex Waygood
0d9d56c4e4
gh-101100: Add a table of class attributes to the "Custom classes" section of the data model docs ( #124480 )
2024-09-25 19:29:58 +00:00
Wei-Hsiang (Matt) Wang
cf472577e2
gh-123517: Remove unnecessary ``:meth:`` parentheses ( #123518 )
2024-09-01 05:59:42 +01:00
Serhiy Storchaka
1a0c7b9ba4
gh-121905: Consistently use "floating-point" instead of "floating point" (GH-121907)
2024-07-19 08:06:02 +00:00
Bénédikt Tran
f4d6e45c1e
gh-120452: improve documentation about private name mangling ( #120451 )
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-07-13 07:45:18 -07:00
Danny Yang
91313afdb3
gh-114104: clarify asynchronous comprehension docs to match runtime behavior ( #121175 )
2024-07-01 22:04:39 +05:30
Paulo Freitas
bf5e1065f4
doc: Mention the missing reflected special methods for all binary operations (GH-119931)
2024-06-04 17:55:11 +00:00
Erlend E. Aasland
dbe44f150c
Docs: mark up NotImplemented using the :data: role throughout the docs ( #116135 )
2024-02-29 20:46:12 +00:00
Terry Jan Reedy
a1332a99cf
Clarify one-item tuple ( #114745 )
...
A 'single tuple' means 'one typle, of whatever length.
Remove the unneeded and slight distracting parenthetical 'singleton' comment.
2024-01-30 18:40:54 +00:00
Hugo van Kemenade
8ccd1ba461
gh-101100: Fix Sphinx warnings in `reference/expressions.rst` ( #114194 )
2024-01-22 18:21:14 +02:00
Sergey B Kirpichev
029ecee10d
gh-114070: fix token reference warnings in expressions.rst ( #114169 )
2024-01-17 18:39:50 +02:00
Raymond Hettinger
97f8f28b3e
gh-112331: Fix reference manual description of attribute lookup mechanics (gh-112375)
2023-11-25 16:20:53 -06:00
Terry Jan Reedy
9a2f25d374
gh-111944: Add assignment expression parentheses requirements ( #111977 )
...
gh-111944: Clarify where assignment expressions require ()s
Augment the list of places where parentheses are
required around assignnment statements. In particular,
'a := 0' and 'a = b := 1' are syntax errors.
2023-11-12 19:06:50 -05:00
Adam Turner
da99133710
GH-101100: Fix reference warnings for ``__getitem__`` ( #110118 )
2023-10-19 18:05:05 +03:00
Ezio Melotti
41d8ec5a1b
gh-110631: Fix reST indentation in `Doc/reference` ( #110708 )
...
Fix wrong indentation in the Doc/reference dir.
2023-10-11 22:50:55 +02:00
Serhiy Storchaka
f2d07d3289
gh-101100: Sphinx warnings: pick the low hanging fruits (GH-107386)
2023-07-29 08:48:10 +03:00
Ned Batchelder
987b712b4a
Replace the esoteric term 'datum' when describing dict comprehensions ( #106119 )
2023-07-02 20:22:40 -07:00
Nicolas Tessore
d56c933992
gh-104770: Let generator.close() return value ( #104771 )
...
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2023-05-23 13:51:56 -07:00
Adam Turner
3e7995ca11
GH-97950: Use new-style index directive ('exception') ( #104160 )
2023-05-04 13:30:24 +03:00
Adam Turner
6ab463684b
GH-97950: Use new-style index directive ('object') ( #104158 )
...
* Uncomment object removal in pairindextypes
* Use new-style index directive ('object') - C API
* Use new-style index directive ('object') - Library
* Use new-style index directive ('object') - Reference
* Use new-style index directive ('object') - Tutorial
2023-05-04 13:04:41 +03:00
Adam Turner
b0ce2db118
GH-97950: Use new-style index directive ('operator') ( #104156 )
2023-05-04 12:03:11 +03:00
Adam Turner
33ca322c50
GH-97950: Use new-style index directive ('keyword') ( #104153 )
...
* Uncomment keyword removal in pairindextypes
* Use new-style index directive ('keyword') - Reference
2023-05-04 10:44:12 +02:00
Kumar Aditya
7feb6d2f85
fix `grammer` -> `grammar` typo in expressions.rst (GH-100683)
...
Automerge-Triggered-By: GH:AlexWaygood
2023-01-02 03:49:06 -08:00
ram vikram singh
1aab269d4a
gh-100201: Document behavior with a bare `yield` statement ( #100416 )
...
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2023-01-01 21:06:13 +05:30
Gerardwx
d578aaea62
Python documents state elsewhere that a comma is not an operator, so … (GH-98736)
...
…calling it an operator here is confusing. See https://docs.python.org/3/reference/lexical_analysis.html#operators and https://docs.python.org/3/faq/programming.html#id22 .
2022-10-26 23:33:42 -07:00
Hugo van Kemenade
296313002f
gh-97913 Docs: Add walrus operator to the index ( #97921 )
...
* Add walrus operator to the index
* Add named expression to the index
Co-authored-by: Mariatta Wijaya <Mariatta@users.noreply.github.com>
* Fix indentation and add missing newline
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: Mariatta Wijaya <Mariatta@users.noreply.github.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2022-10-08 08:54:16 +02:00
Hugo van Kemenade
fa2d43e518
Docs: Fix backtick errors found by sphinx-lint ( #97998 )
...
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2022-10-06 18:01:30 -07:00
Terry Jan Reedy
2b5f1360ea
gh-86482: Document assignment expression need for ()s ( #23291 )
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-10-06 12:24:17 -07:00
Ofey Chan
83a3de4e06
gh-96348: Deprecate the 3-arg signature of coroutine.throw and generator.throw (GH-96428)
2022-09-30 09:43:02 +01:00
Andrew Kay
d582edf0be
Fix docs on conditional expression grouping (GH-96447)
2022-09-27 21:57:32 -05:00
Jeff Allen
9d432b4a18
gh-96397: Document that keywords in calls need not be identifiers ( #96393 )
...
This represents the official SC stance, see
https://github.com/python/steering-council/issues/142#issuecomment-1252172695
2022-09-22 11:10:15 -07:00
luzpaz
830513754d
gh-93675: Fix typos in `Doc/` (GH-93676)
...
Closes #93675
2022-06-21 21:10:45 +02:00
Zackery Spytz
fb082c2fc5
bpo-45393: help() on operator precedence has misleading entries (GH-31246)
...
Fix the formatting for "await x" and "not x" in the operator
precedence table.
2022-05-19 17:05:04 +02:00
Dave Goncalves
8be7c2bc5a
bpo-14911: Corrected generator.throw() documentation (GH-32207)
...
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-03-31 16:56:48 +03:00
Alex Waygood
50731297a9
bpo-45680: Improve docs on subscriptions w.r.t. `GenericAlias` objects (GH-29479)
2022-03-07 19:49:28 -08:00
Jacob Walls
273cb8e757
bpo-24650: Use full term "generator function" in yield expressions docs (GH-24663)
2022-01-07 18:39:40 +00:00
Arthur Milchior
32959108f9
bpo-45640: [docs] Tokens are now clickable (GH-29260)
...
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-11-18 17:06:38 +01:00
Ethan Furman
6ecead106a
[doc] minor fixes to expressions.rst (GH-29444)
2021-11-06 10:26:43 -07:00
Tim Peters
51ed2c56a1
bpo-45530: speed listobject.c's unsafe_tuple_compare() (GH-29076)
...
Keep track of whether unsafe_tuple_compare() calls are resolved by the very
first tuple elements, and adjust strategy accordingly. This can significantly
cut the number of calls made to the full-blown PyObject_RichCompareBool(),
and especially when duplicates are rare.
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-10-24 22:27:24 -05:00
Objectivitix
806e25fd31
bpo-45003: Change __div__ to __truediv__ in py3 language reference. (GH-27951)
2021-08-26 08:49:02 +03:00
andrei kulakov
4bd9caafb6
bpo-41911: Update docs for various expressions (GH-27470)
...
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-07-30 18:52:44 +02:00
Serhiy Storchaka
054e9c84ac
bpo-33346: Allow async comprehensions inside implicit async comprehensions (GH-6766)
...
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2021-07-13 22:27:50 +01: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
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
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
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
Joongi Kim
6e8dcdaaa4
bpo-41229: Update docs for explicit aclose()-required cases and add contextlib.aclosing() method (GH-21545)
...
This is a PR to:
* Add `contextlib.aclosing` which ia analogous to `contextlib.closing` but for async-generators with an explicit test case for [bpo-41229]()
* Update the docs to describe when we need explicit `aclose()` invocation.
which are motivated by the following issues, articles, and examples:
* [bpo-41229]()
* https://github.com/njsmith/async_generator
* https://vorpus.org/blog/some-thoughts-on-asynchronous-api-design-in-a-post-asyncawait-world/#cleanup-in-generators-and-async-generators
* https://www.python.org/dev/peps/pep-0533/
* https://github.com/achimnol/aiotools/blob/ef7bf0cea7af/src/aiotools/context.py#L152
Particuarly regarding [PEP-533](https://www.python.org/dev/peps/pep-0533/ ), its acceptance (`__aiterclose__()`) would make this little addition of `contextlib.aclosing()` unnecessary for most use cases, but until then this could serve as a good counterpart and analogy to `contextlib.closing()`. The same applies for `contextlib.closing` with `__iterclose__()`.
Also, still there are other use cases, e.g., when working with non-generator objects with `aclose()` methods.
2020-11-02 00:02:48 -08:00
kj
9129af6050
bpo-42198: Link to GenericAlias in typing and expressions (GH-23030)
...
Follow up to 7cdf30fff3
and 4173320920
. This addresses the point "1. Update links in typing, subscription and union to point to GenericAlias." in the bpo for this PR.
2020-10-29 21:01:17 -07:00