We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the style change Black is not consistent when arguments can be many types.
This is the original format, both stat_lengthh and stat_lengths have the same typing but one has parenthesis around it:
stat_lengthh
stat_lengths
from __future__ import annotations from typing import Any, Mapping class test: def pad( self, stat_lengthh: (int | tuple[int, int] | Mapping[Any, tuple[int, int]] | None) = None, stat_lengths: int | tuple[int, int] | Mapping[Any, tuple[int, int]] | None = None, ): pass
Examples in the current Black style
Black formats the same typing in two different ways making it hard to see they are exactly the same:
from __future__ import annotations from typing import Any, Mapping class test: def pad( self, stat_lengthh: ( int | tuple[int, int] | Mapping[Any, tuple[int, int]] | None ) = None, stat_lengths: int | tuple[int, int] | Mapping[Any, tuple[int, int]] | None = None, ): pass
Desired style I prefer the variant with parenthesis, the extra indent makes it easier to tell where the new arguments are.
from __future__ import annotations from typing import Any, Mapping class test: def pad( self, stat_lengthh: ( int | tuple[int, int] | Mapping[Any, tuple[int, int]] | None ) = None, stat_lengths: ( int | tuple[int, int] | Mapping[Any, tuple[int, int]] | None ) = None, ): pass
Additional context
The text was updated successfully, but these errors were encountered:
All for the consistency, but personally I'm not sure which style would be better. Thanks for reporting!
Sorry, something went wrong.
I also prefer the parenthesized version, since it makes it easier to see where each new parameter starts.
Anyway, this is a duplicate of #2316.
No branches or pull requests
Describe the style change
Black is not consistent when arguments can be many types.
This is the original format, both
stat_lengthh
andstat_lengths
have the same typing but one has parenthesis around it:Examples in the current Black style
Black formats the same typing in two different ways making it hard to see they are exactly the same:
Desired style
I prefer the variant with parenthesis, the extra indent makes it easier to tell where the new arguments are.
Additional context
The text was updated successfully, but these errors were encountered: