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.