https://github.com/python/cpython/commit/83fe630f6f56da8acf0bb0c53639c6db30859461
commit: 83fe630f6f56da8acf0bb0c53639c6db30859461
branch: main
author: Inada Naoki <[email protected]>
committer: methane <[email protected]>
date: 2026-10-30T12:11:45+09:00
summary:
Docs: fix generic class and comprehension examples (#160908)
files:
M Doc/reference/compound_stmts.rst
M Doc/reference/expressions.rst
diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst
index c13860eb3e9319a..7939b18306a2f28 100644
--- a/Doc/reference/compound_stmts.rst
+++ b/Doc/reference/compound_stmts.rst
@@ -1849,9 +1849,9 @@ The following example indicates the full set of allowed
type parameter declarati
def overly_generic[
SimpleTypeVar,
- TypeVarWithDefault = int,
TypeVarWithBound: int,
TypeVarWithConstraints: (str, bytes),
+ TypeVarWithDefault = int,
*SimpleTypeVarTuple = (int, float),
**SimpleParamSpec = (str, bytearray),
](
@@ -1952,7 +1952,7 @@ and decorators are evaluated outside that scope. This is
illustrated
by this example::
@decorator
- class Bag(Base[T], arg=T): ...
+ class Bag[T](Base[T], arg=T): ...
This is equivalent to::
diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst
index 2e0b6621eb11c86..558f94e65f6c3fc 100644
--- a/Doc/reference/expressions.rst
+++ b/Doc/reference/expressions.rst
@@ -703,9 +703,9 @@ For example, here is a set of lowercase letters::
At run time, this corresponds roughly to calling this function::
def make_lowercase_set(iterable):
- result = set(iterable)
+ result = set()
for x in iterable:
- result.append(x.lower())
+ result.add(x.lower())
return result
make_lowercase_set(['a', 'A', 'b', 'C'])
@@ -726,7 +726,7 @@ At run time, this corresponds roughly to::
result[func.__name__] = func
return result
- iterable([print, hex, any])
+ make_dict_mapping_names_to_functions([print, hex, any])
As in other kinds of dictionary displays, the same key may be specified
multiple times.
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]