0
intersection = lambda *p: list(set(p[1]) & set(p[2]))

I kinda get lambda functions but am completely thrown by the *p here. Can anyone explain?

Maverick
  • 3
  • 1
  • if you remove `*`, script still work or not? can you paste working example? – Lei Yang Mar 24 '22 at 06:53
  • 1
    that just signifies variadic positional arguments, like `def intersection(*p): ...` note, generally, you shouldn't assign the result of a lambda expression to a name, at least according to PEP8, because it defeats the only purpose of a lambda, which is to be anonymous, so you might as well use a regular function definition statement instead of the lambda expression – juanpa.arrivillaga Mar 24 '22 at 06:54

0 Answers0