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
I came across a strange formatting of the function declaration in the presence of generic typing. As a minimal example, I will give a function with one argument:
In this example, type T is not used, but you can also come up with a function in which type T is used, for example, using collections.abc.XXX[T] instead of argument_type and return_type.
It is assumed that the maximum length of the line has been changed, in this example, the value 50 is used (black -l 50 ...).
It seems to me that it is worth first trying to split arguments into several lines, and only then trying to separate generic declaration.
Examples in the current Black style
deffunc[
T
](argument: argument_type) ->return_type:
pass
Describe the style change
I came across a strange formatting of the function declaration in the presence of generic typing. As a minimal example, I will give a function with one argument:
In this example, type
T
is not used, but you can also come up with a function in which typeT
is used, for example, usingcollections.abc.XXX[T]
instead ofargument_type
andreturn_type
.It is assumed that the maximum length of the line has been changed, in this example, the value 50 is used (
black -l 50 ...
).It seems to me that it is worth first trying to split arguments into several lines, and only then trying to separate generic declaration.
Examples in the current Black style
Desired style
Additional context
My
black
version:The text was updated successfully, but these errors were encountered: