Skip to content

Commit 75b9331

Browse files
docs(function): Allign docs and clean redaction.
1 parent 4a016e5 commit 75b9331

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

docs/pages/language/functions.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: "Functions"
33
description: "First-class functions, lambdas, closures, generators."
44
---
55

6-
Functions are the central abstraction, values that can be passed, returned, stored, composed.
6+
Functions are the central abstraction: values that can be passed, returned, stored, and composed.
77

88
## def
99

@@ -78,7 +78,7 @@ print(opts(host="api", port=443))
7878

7979
### Keyword-only parameters
8080

81-
A bare `*` marks every following parameter as keyword-only, positional args never reach them.
81+
A bare `*` marks every following parameter as keyword-only; positional args never reach them.
8282

8383
```python
8484
def connect(host, *, port=80, secure=False):
@@ -142,7 +142,7 @@ Hi, world
142142

143143
## First-class functions
144144

145-
Functions are values, store, pass, return.
145+
Functions are values: store, pass, return them.
146146

147147
```python
148148
ops = [abs, len, str]
@@ -156,9 +156,9 @@ print([f(-3) for f in ops])
156156
```python
157157
# Functions as dict values; replaces switch/case
158158
handlers = {
159-
"add": lambda a, b: a + b,
160-
"mul": lambda a, b: a * b,
161-
"max": max,
159+
"add": lambda a, b: a + b,
160+
"mul": lambda a, b: a * b,
161+
"max": max,
162162
}
163163

164164
print(handlers["add"](3, 4))
@@ -343,11 +343,11 @@ Naive recursion runs at memoized cost without source-level changes.
343343

344344
```python
345345
def squares(n):
346-
for i in range(n):
347-
yield i * i
346+
for i in range(n):
347+
yield i * i
348348

349349
for x in squares(5):
350-
print(x)
350+
print(x)
351351
```
352352

353353
```text Output
@@ -452,7 +452,7 @@ print(base(5))
452452
12
453453
```
454454

455-
Parameterised decorators are factories, a function taking decorator args and returning the actual decorator. The wrapped function captures both scopes.
455+
Parameterised decorators are factories a function taking decorator args and returning the actual decorator. The wrapped function captures both scopes.
456456

457457
```python
458458
def repeat(n):

0 commit comments

Comments
 (0)