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

black introduces PEP 8 violation: operators should go at beginning of lines when possible #21

Closed
njsmith opened this issue Mar 15, 2018 · 3 comments
Labels
good first issue Good for newcomers T: bug Something isn't working

Comments

@njsmith
Copy link

njsmith commented Mar 15, 2018

 @contextmanager
 def ki_manager(deliver_cb, restrict_keyboard_interrupt_to_checkpoints):
     if (
-        threading.current_thread() != threading.main_thread()
-        or signal.getsignal(signal.SIGINT) != signal.default_int_handler
+        threading.current_thread() != threading.main_thread() or
+        signal.getsignal(signal.SIGINT) != signal.default_int_handler
     ):

Ok, technically PEP 8 waffles a bit b/c it used to recommend the other version. But these days it says that operator-at-beginning "usually results in more readable code" and "For new code [operator-at-beginning] style is suggested".

@ambv
Copy link
Collaborator

ambv commented Mar 15, 2018

Oh, I never noticed PEP 8's change in direction here. This is a relatively new change, Knuth-inspired, no less:

python/peps@c59c437

I can make this change in Black, although it's a surprising one to me. What do you think about this personally?

@njsmith
Copy link
Author

njsmith commented Mar 15, 2018

This was always one of my biggest wtf's with PEP 8, so I'm excited they changed it :-)

@ambv ambv added T: bug Something isn't working good first issue Good for newcomers labels Mar 16, 2018
@ambv ambv closed this as completed in 47ae92c Mar 17, 2018
@ambv
Copy link
Collaborator

ambv commented Mar 17, 2018

Yay! Thanks, @autophagy.

ambv added a commit that referenced this issue Mar 17, 2018
ambv pushed a commit that referenced this issue Mar 19, 2018
ambv added a commit that referenced this issue Mar 19, 2018
jsf9k added a commit to cisagov/cyhy-mailer that referenced this issue Apr 15, 2019
Also ignore W503 from flake8.  It no longer agrees with PEP8.  See
these two links for details:
psf/black#21
python/peps@c59c437
jsf9k added a commit to cisagov/skeleton-generic that referenced this issue Apr 15, 2019
This is a warning about line breaks before binary operators.  It no
longer agrees with PEP8.  See, for example, here:
psf/black#21.

Guido agrees here:
python/peps@c59c437.
jsf9k added a commit to cisagov/ansible-role-oracle-java that referenced this issue Dec 13, 2019
This is a warning about line breaks before binary operators.  It no
longer agrees with PEP8.  See, for example, here:
psf/black#21.

Guido agrees here:
python/peps@c59c437.
jonathanhaigh added a commit to jonathanhaigh/multiconfparse that referenced this issue Jun 5, 2020
jonathanhaigh added a commit to jonathanhaigh/multiconfparse that referenced this issue Jun 5, 2020
jonathanhaigh added a commit to jonathanhaigh/multiconfparse that referenced this issue Jun 5, 2020
rnc added a commit to rnc/cekit that referenced this issue Aug 2, 2022
rnc added a commit to cekit/cekit that referenced this issue Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers T: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants