File: fun_kwargs.py

package info (click to toggle)
micropython 1.25.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 48,944 kB
  • sloc: ansic: 317,850; python: 59,539; xml: 4,241; makefile: 3,530; sh: 1,421; javascript: 744; asm: 681; cpp: 45; exp: 11; pascal: 6
file content (35 lines) | stat: -rw-r--r-- 431 bytes parent folder | download | duplicates (4)
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
def f1(a):
    print(a)

f1(123)
f1(a=123)
try:
    f1(b=123)
except TypeError:
    print("TypeError")

def f2(a, b):
    print(a, b)

f2(1, 2)
f2(a=3, b=4)
f2(b=5, a=6)
f2(7, b=8)
try:
    f2(9, a=10)
except TypeError:
    print("TypeError")

def f3(a, b, *args):
    print(a, b, args)


f3(1, b=3)
try:
    f3(1, a=3)
except TypeError:
    print("TypeError")
try:
    f3(1, 2, 3, 4, a=5)
except TypeError:
    print("TypeError")