Open Clement-Lelievre opened 1 year ago
Ah wait! Now I see! Keyword args.
Hey yeah, that's a neet trick worth mentioning. Will keep this ticket open!
A possible use case is shown here
Here is a MRE:
funcs = [lambda x: x + i for i in range(3)]
X = 5
for func in funcs:
print(func(X))
What output do you expect? Using kwargs fixes the issue
Maybe it's worth mentioning here that Python lambda functions accept keyword arguments.
Surprisingly, it isn't mentioned in the docs (at least not here)
The following code is thus valid: