Open jpy-git opened 2 years ago
Is your feature request related to a problem? Please describe.
At the moment black doesn't seem to have any strong opinions on brackets around lambda expressions in functions.
Describe the solution you'd like
I had a couple initial thoughts:
A) Remove brackets if it's used as a positional argument i.e.
map((lambda n: n**2), [1, 2, 3, 4, 5])
becomes
map(lambda n: n**2, [1, 2, 3, 4, 5])
B) require brackets when used as a keyword argument (or default arg in function def)
foo(func=lambda x: x**2)
foo(func=(lambda x: x**2))
Additional context
Saw option B) in a code review the other day and thought it would read better if the lambda expression was clearly grouped.
My 2c: definitely remove for A. My first reaction for B was to also remove but it's fine for me either way. The value of a long lambda can be parenthesised anyway.
Is your feature request related to a problem? Please describe.
At the moment black doesn't seem to have any strong opinions on brackets around lambda expressions in functions.
Describe the solution you'd like
I had a couple initial thoughts:
A) Remove brackets if it's used as a positional argument i.e.
becomes
B) require brackets when used as a keyword argument (or default arg in function def)
becomes
Additional context
Saw option B) in a code review the other day and thought it would read better if the lambda expression was clearly grouped.