-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Allow whitespace alignment of tables of numbers? #12367
Comments
I also made a request to pycodestyle in PyCQA/pycodestyle#924, before I saw @endolith's earlier issue and comments. I agree that we should be able to create aligned arrays of data without our style checker complaining about whitespace issues. I would have been OK (if not completely happy) with appending With |
I have made use of |
gh-12367 is wondering what to do about this sort of thing. Remove the offending whitespace for now? |
@mdhaber I think you accidentally linked back to this issue instead of some other PR (?). In any case, for now I think remove it or or |
I think in theory we can implement this without too much work or complexity in a separate
Will then produce when calling:
These new So if people are okay with:
Then I think we can make this work. |
One possible option up at #12516 |
these are now allowed by the current lint suite |
For example,
np.arange(0, 120).reshape(12, 10)
is formatted by NumPy asbut the linters used in unit testing reject tables of numbers like this because of rules like these:
and require changing to the less readable
I've listed a bunch of other examples here: PyCQA/pycodestyle#289 (comment)
I think this is a misapplication of PEP8, and this type of formatting should be allowed, but turning off these error codes completely would be bad, since they are much broader than this, and are correct for one-line lists, etc.
Ideally the rules for tables of data would be changed in PEP8 and pycodestyle, so it trickles down to everything that depends on them, but my attempts at requesting changes to pycodestyle and PEP8 were rejected: PyCQA/pycodestyle#289 python/peps#1428 If you know of a better place to lobby for this, we could try that.
Otherwise, it seems all we could do is implement plugins to flake8 to prevent this from happening? Maybe there are other workarounds.
See also spyder-ide/spyder#9955 and this PR failure and this PR failure.
The text was updated successfully, but these errors were encountered: