-
Notifications
You must be signed in to change notification settings - Fork 12
reformat #48
New issue
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
reformat #48
Conversation
Ruff's formatter is based on Black, which has become the standard formatter for Python. The philosophy of Black is to have as little parameters as possible; personal preferences should be avoided, as they are incompatible with consistency. Black's formatting choices are generally pragmatic, favoring readability over compactness. For example, in the current code base, the following pattern function(lots, of, arguments,
and, even, more, arguments) has several drawbacks
I actually don't like all the choices of Black either, but consistency is worth the price. |
Hm, I'd rather realign the arguments (Ctrl-Shift-Alt-L in PyCharm) than spend 90% of the screen on whitespace with function(
lots,
of,
arguments,
and,
even,
more,
arguments,
): It's definitely more consistent, especially with type hints. However, it'd also make maintenance uncomfortable with half the file being function definitions. As far as I can tell, these choices are on purpose and should invite you to stop using functions with many arguments, but the often-recommended alternatives (like context objects) aren't necessarily more readable either. To be clear, I'm fully aware that the current 10+ layers of abstractions aren't friendly to debug or maintain, so, ideally, we should find a solution for that, too. |
If there are not too many such cases, you could consider using I also think that using cascading keyword arguments could help with reducing the number of function arguments. |
I've further re-enabled opt-einsum. It was previously disabled due to a bug on PyTorch's end, where many functions couldn't be compiled. This appears to be fixed now, so we can re-enable it. |
I'm not happy with many of ruff's formatting changes and had to change/remove some of the tests. This may be a good opportunity to go through the unit tests again and ensure everything works in the new API.