refactor to reduce boilerplate code
This commit is contained in:
26
snippets/test04.py
Normal file
26
snippets/test04.py
Normal file
@ -0,0 +1,26 @@
|
||||
def test(a, b, c, d, e, f, g):
|
||||
print(f"{a=}, {b=}, {c=}, {d=}, {e=}, {g=}")
|
||||
|
||||
|
||||
params = {
|
||||
"a": 1,
|
||||
"b": 2,
|
||||
"c": 3,
|
||||
"d": 4,
|
||||
"e": 5,
|
||||
"f": 6,
|
||||
"g": 7
|
||||
}
|
||||
test(*params)
|
||||
|
||||
params = [1, 2, 3, 4, 5, 6, 7]
|
||||
test(*params)
|
||||
|
||||
p1 = []
|
||||
p2 = [2, 3, 4, 5, 6, 7, 8]
|
||||
test(*p1, *p2)
|
||||
|
||||
p1 = None
|
||||
p2 = [2, 3, 4, 5, 6, 7, 8]
|
||||
test(*p1, *p2)
|
||||
|
Reference in New Issue
Block a user