I would have expected
def f(x,):
pass
to have its comma removed by Black, but that doesn't happen.
I think we should always remove the trailing comma if the function arguments fit on a single line.
(I ran into this when I removed a function's second argument and relied on Black to get rid of the trailing comma.)
Yes, that annoys me, too.
Is this related to #1288?
Do we have a pr for this already? I can create one if needed.
is this now solved? @JelleZijlstra @ambv
On master this has not been solved. I also can't see a PR for this issue. I think it would great if @felippemr could open one if he is still up for it?
Closing as this issue doesn't make sense anymore after #826 and #1612 landed. The trailing comma will never be removed as it now has special meaning to Black. It is now a "magic" trailing comma and will cause the function parameter list to be exploded by Black.
def f(x,):
pass
will be formatted (by Black 20.8b1) to:
def f(
x,
):
pass
For the reader who has randomly stumbled across this issue and wants to know about the "magic trailing comma" feature, please read its documentation.
Most helpful comment
Is this related to #1288?