Skip to content

Conversation

@brandtbucher
Copy link
Contributor

Fixes #646. This patch forces expressions containing unary and power ops, like this...

+a ** -b ** ~c ** -d  # This is legal blackened code.

...to be reformatted with parentheses to make operator precedence clear, like this...

+(a ** -(b ** ~(c ** -d)))  # This is legal blackened code.

@brandtbucher
Copy link
Contributor Author

The two remaining mypy errors are due to #907, unrelated.

@brandtbucher
Copy link
Contributor Author

Is there anything more I need to do for this? This is my first time contributing, so I'm not sure if I missed something!

@JelleZijlstra JelleZijlstra merged commit b073c9a into psf:master Jun 29, 2019
@brandtbucher
Copy link
Contributor Author

Thanks!

ambv added a commit that referenced this pull request Oct 28, 2019
This was caused by an overly liberal application of parentheses in #909 that
fixed #646.

Fixes #1041
charliermarsh added a commit to astral-sh/ruff that referenced this pull request Oct 16, 2023
## Summary

E.g., given `-10**100`, reformat as `-(10**100)`.

Black special cases this (psf/black#909) and
it's currently a deviation.

Closes #7951.
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

Successfully merging this pull request may close these issues.

combination of unary and power operator leads to misleading formatting.

2 participants