Nice project.
after reading https://github.com/psf/black#how-black-wraps-lines, I have some questions:
when I declare a function:
# in:
def important_method(exc, limit, lookup_lines, capture_locals, extra_argument)
# out:
def important_method(
exc, limit, lookup_lines, capture_locals, extra_argument
)
why not always:
def important_method(
exc,
limit,
lookup_lines,
capture_locals,
extra_argument,
)
with typing hints it will be:
def important_method(
exc: some_type,
limit: some_limit_type,
lookup_lines: some_line_type,
capture_locals: some_capture_type,
extra_argument: some_extra_type,
)
It looks more clear I think. Personally, I think function declaration is totally different with function calling. Declaration should be very clear and readable.
Thanks :)
I agree here. Black currently introduces inconsistency by having parameters sometimes in one line and sometimes in multiple lines. For the sake of consistency, if the function signature does not fit in one line, I prefer to put the parameters one per line.
This is all explained in the README.
This is all explained in the README.
https://github.com/psf/black#how-black-wraps-lines
Do you mean this? I do not think it is a good design which treating all the lines equally ..
Function signature is important and it should be easy to read. As @MaxG87 said, I would rather put the parameters one per line.
Because of this, I have to inject some hints between lines to break this rule:
def important_method(
# this is exc
exc,
# this is limit
limit,
)
But it is a little weird and sometimes I do not need these hints at all.
Black reformats entire files in place. It is not configurable.
And unfortunately it can not be a option :(
yes, maybe someone prefers putting all these arguments into one line and of course I can not say this design is totally bad. I think we need more decision about this.
I think it is not quite difficult to implement (I am not sure) because black know what all these lines actually are.
https://github.com/psf/black/blob/991f19031cc66dbaa62384a6f7387a3db5c58335/black.py#L1363
I understand there are differences in opinion about how function signatures are formatted, that's completely fine. This decision has been made a long time ago, and at this time we won't be revising it anymore - we'd rather spend our energy towards a stable release.
I'm sorry if this is disappointing. You can always use # fmt: off blocks for one-off situations where you really care about hand-formatting.
Most helpful comment
I agree here. Black currently introduces inconsistency by having parameters sometimes in one line and sometimes in multiple lines. For the sake of consistency, if the function signature does not fit in one line, I prefer to put the parameters one per line.