refactor to reduce boilerplate code

This commit is contained in:
2025-04-02 13:24:08 +02:00
parent 2331bd6aa3
commit e49bcbc634
3 changed files with 136 additions and 0 deletions

26
snippets/test04.py Normal file
View 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)