Skip to content
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

E222: Disallow whitespace after unary negative? #941

Open
PeterJCLaw opened this issue May 26, 2020 · 2 comments
Open

E222: Disallow whitespace after unary negative? #941

PeterJCLaw opened this issue May 26, 2020 · 2 comments

Comments

@PeterJCLaw
Copy link

Should pycodestyle disallow whitespace between a unary negation and its symbol?

foo = - 2
@sigmavirus24
Copy link
Member

Maybe. I can imagine if we disallowed that the scientific python community would be just as furious as every time they discover they can't visually align decimals inside a matrix. (I think I've even seen examples where they visually align the sign of the number so that vertically it looks like:

-  0.01,
  10.52,
-234.27,

Which I'm not endorsing as good general style, but I really don't want a tonne more issues from people complaining that we're making their code ugly.

@PeterJCLaw
Copy link
Author

Hrm, I can definitely see a case for that style in the specific case of tabular data.

Is it not enough to for this to have its own error id which can then be opted in/out?

Trying out the case you're suggesting, there are a couple of other errors I get, so users would already need to be handling those:

fab = [
    -  0.01,
      10.52,
    -234.27,
]
demo.py:2:6: E222 multiple spaces after operator
demo.py:3:7: E131 continuation line unaligned for hanging indent

Though admittedly those errors don't show if the values are part of tuples rather than being on their own.

@asottile asottile changed the title Disallow whitespace after unary negative? E222: Disallow whitespace after unary negative? Jun 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants