Fix PEP-0603 code sample indentation (#1176)
This commit is contained in:
parent
75467baf69
commit
954b8f5486
24
pep-0603.rst
24
pep-0603.rst
|
@ -215,23 +215,23 @@ a context manager::
|
|||
numbers = frozenmap((i, i ** 2) for i in range(1_000_000))
|
||||
|
||||
with numbers.mutating() as copy:
|
||||
for i in numbers:
|
||||
if not (numbers[i] % 997):
|
||||
del copy[i]
|
||||
for i in numbers:
|
||||
if not (numbers[i] % 997):
|
||||
del copy[i]
|
||||
|
||||
numbers_without_997_multiples = frozenmap(copy)
|
||||
numbers_without_997_multiples = frozenmap(copy)
|
||||
|
||||
# at this point, *numbers* still has 1_000_000 key/values, and
|
||||
# *numbers_without_997_multiples* is a copy of *numbers* without
|
||||
# values that are multiples of 997.
|
||||
# at this point, *numbers* still has 1_000_000 key/values, and
|
||||
# *numbers_without_997_multiples* is a copy of *numbers* without
|
||||
# values that are multiples of 997.
|
||||
|
||||
for i in numbers:
|
||||
if not (numbers[i] % 593):
|
||||
del copy[i]
|
||||
for i in numbers:
|
||||
if not (numbers[i] % 593):
|
||||
del copy[i]
|
||||
|
||||
numbers_without_593_multiples = frozenmap(copy)
|
||||
numbers_without_593_multiples = frozenmap(copy)
|
||||
|
||||
print(copy[10]) # will print 100.
|
||||
print(copy[10]) # will print 100.
|
||||
|
||||
print(copy[10]) # This will throw a ValueError as *copy*
|
||||
# has been closed when the "with" block
|
||||
|
|
Loading…
Reference in New Issue