Skip to content

Commit fff67ae

Browse files
docs(control flow): Allign docs and clean redaction.
1 parent 3c8443b commit fff67ae

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

docs/pages/language/control-flow.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ for i in range(10):
101101
break
102102
if i % 2 == 0:
103103
continue
104-
print(i)
104+
print(i)
105105
```
106106

107107
```text Output
@@ -128,7 +128,7 @@ done
128128

129129
Subset supported: literal patterns, capture variables, `_` wildcard, OR (`|`), guards (`if`), sequence patterns with `*rest`.
130130

131-
Sequence-pattern items must be literals (`int` / `float` / `str` / `True` / `False` / `None`), capture names, or `_`. Nested sequences (`case [[a, b], c]:`), mapping patterns (`{"key": x}`), class patterns (`Point(x=0)`), and `as` captures are unsupported, use chained `if` / `elif`.
131+
Sequence-pattern items must be literals (`int` / `float` / `str` / `True` / `False` / `None`), capture names, or `_`. Nested sequences (`case [[a, b], c]:`), mapping patterns (`{"key": x}`), class patterns (`Point(x=0)`), and `as` captures are unsupported; use chained `if` / `elif` instead.
132132

133133
```python
134134
def classify(p):
@@ -165,11 +165,11 @@ span 1..5
165165
def describe(n):
166166
match n:
167167
case 0:
168-
return "zero"
168+
return "zero"
169169
case 1:
170-
return "one"
170+
return "one"
171171
case _:
172-
return "many"
172+
return "many"
173173

174174
for x in [0, 1, 2, 99]:
175175
print(describe(x))
@@ -246,7 +246,7 @@ except ValueError:
246246
rejected
247247
```
248248

249-
`raise X from Y` raises `X`. The `from` clause parses and the cause evaluates, but `__cause__` / `__context__` aren't preserved, only `X` reaches the handler.
249+
`raise X from Y` raises `X`. The `from` clause parses and the cause evaluates, but `__cause__` / `__context__` aren't preserved; only `X` reaches the handler.
250250

251251
```python
252252
try:
@@ -278,7 +278,7 @@ Pre-bound exception classes (with their parent links so `except <Parent>:` match
278278

279279
## with
280280

281-
`with` drives the context-manager protocol: evaluate the expression, call `__enter__`, bind the result to `as`. On exit, `__exit__(exc_type, exc_value, traceback)` runs, `(None, None, None)` on normal completion, live exception info on raise. Truthy return suppresses; falsy propagates. See [`/language/dunders`](/language/dunders).
281+
`with` drives the context-manager protocol: evaluate the expression, call `__enter__`, bind the result to `as`. On exit, `__exit__(exc_type, exc_value, traceback)` runs: `(None, None, None)` on normal completion, live exception info on raise. Truthy return suppresses; falsy propagates. See [`/language/dunders`](/language/dunders).
282282

283283
```python
284284
x = [1, 2]

0 commit comments

Comments
 (0)