keyword arguments before positional arguments- syntax inconsistency
25 Aug
2020
25 Aug
'20
1:22 p.m.
consider the following function: def foo(a,b,c,x): pass The following calls are equivalent: foo(1,2,3, x=0) foo(*(1,2,3), x=0) However, since python allows keyword arguments before star-unpacking, you can also do: foo(x=0, *(1, 2, 3)) But removing the unpacking, would result in a syntax error: foo(x=0, 1, 2, 3) This is against the understanding of unpacking, is this intentional?
1312
Age (days ago)
1312
Last active (days ago)
2 comments
3 participants
participants (3)
-
Bar Harel
-
Ben Avrahami
-
Jonathan Fine