You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Referring to #330, I know you said you weren't going to fix this, but @sjohannes found a good solution that is very Blackish and IMHO worth considering.
Minimized Real Source ™️ :
from gi.repository import GtkTemplate
class Something:
found_label, \
playlists, \
replace, \
replace_entry, \
search_entry, \
tracks_list = GtkTemplate.Child.widgets(6)
Which currently reformats to a really long ugly line:
from gi.repository import GtkTemplate
class Something:
found_label, playlists, replace, replace_entry, search_entry, tracks_list = GtkTemplate.Child.widgets(
6
)
It turns out that if you add parentheses to the left tuple, it is (a) still equivalent and (b) black does the Right Thing. Here's what that looks like:
from gi.repository import GtkTemplate
class Something:
(found_label, \
playlists, \
replace, \
replace_entry, \
search_entry, \
tracks_list) = GtkTemplate.Child.widgets(6)
And black does this:
from gi.repository import GtkTemplate
class Something:
(
found_label,
playlists,
replace,
replace_entry,
search_entry,
tracks_list,
) = GtkTemplate.Child.widgets(6)
Which is a very Black style.
My request in this issue would be for black to add parentheses to the left tuple if it gets too long and format it as it currently does.
It can be shown that Black already does this for long tuples on the right side. It seems that for consistency it should apply the same style to tuples on the left as well.
The text was updated successfully, but these errors were encountered:
If you put the parentheses yourself, Black will keep them. That is a possible workaround for you. We won't be doing this by default since, as I said in the previous issue, your code will look more obvious if you do a mild refactor in that place.
I avoid splitting left-hand side of assignments since this is not how people write and read those things. When you first write code, you start on one line and keep going until you hit the column limit. When people read, this is what they instinctively do, too. A split that is too early looks foreign.
Referring to #330, I know you said you weren't going to fix this, but @sjohannes found a good solution that is very Blackish and IMHO worth considering.
Minimized Real Source ™️ :
Which currently reformats to a really long ugly line:
It turns out that if you add parentheses to the left tuple, it is (a) still equivalent and (b) black does the Right Thing. Here's what that looks like:
And black does this:
Which is a very Black style.
My request in this issue would be for black to add parentheses to the left tuple if it gets too long and format it as it currently does.
It can be shown that Black already does this for long tuples on the right side. It seems that for consistency it should apply the same style to tuples on the left as well.
The text was updated successfully, but these errors were encountered: