Skip to content

Commit ef1f9d1

Browse files
committed
attempt to fix incorrect examples in 'How to Teach This'
1 parent 4414457 commit ef1f9d1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

peps/pep-0798.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,8 @@ by a similar analogy::
559559
for x in it:
560560
out[k_expr] = v_expr
561561

562-
# equivalent to out = {**expr for x in it}
562+
# equivalent to out = {**expr for x in it}, provided that expr evaluates to
563+
# a mapping that can be unpacked with **
563564
out = {}
564565
for x in it:
565566
out.update(expr)
@@ -597,7 +598,7 @@ Similarly, we can think of ``out = {...x... for x in it}`` as equivalent to the
597598
following code, regardless of whether or not ``...x...`` uses ``*`` or ``**``
598599
or ``:``::
599600

600-
out = set()
601+
out = set() # or out = {}
601602
for x in it:
602603
out.update({...x...})
603604

0 commit comments

Comments
 (0)