forked from fluentpython/example-code-2e
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharg_lab.py
More file actions
36 lines (26 loc) · 621 Bytes
/
Copy patharg_lab.py
File metadata and controls
36 lines (26 loc) · 621 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import typing
from typing import Optional
def f(a: str, *b: int, **c: float) -> None:
if typing.TYPE_CHECKING:
# reveal_type(b)
reveal_type(c)
print(a, b, c)
def g(__a: int) -> None:
print(__a)
def h(a: int, /) -> None:
print(a)
def tag(
name: str,
/,
*content: str,
class_: Optional[str] = None,
foo: Optional[str] = None,
**attrs: str,
) -> str:
return repr((name, content, class_, attrs))
f(a='1')
f('1', 2, 3, x=4, y=5)
g(__a=1)
# h(a=1)
print(tag('li', 'first', 'second', id='#123'))
print(tag('li', 'first', 'second', class_='menu', id='#123'))