]> git.madduck.net Git - etc/vim.git/commit

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Hug power operators if its operands are "simple" (#2726)
authorRichard Si <63936253+ichard26@users.noreply.github.com>
Tue, 25 Jan 2022 03:13:34 +0000 (22:13 -0500)
committerGitHub <noreply@github.com>
Tue, 25 Jan 2022 03:13:34 +0000 (19:13 -0800)
commit6417c99bfdbdc057e4a10aeff9967a751f4f85e9
tree6bb895a397c3c6a5a4a51ababd4356a517ef7987
parent73cb6e7734370108742d992d4fe1fa2829f100fd
Hug power operators if its operands are "simple" (#2726)

Since power operators almost always have the highest binding power in expressions, it's often more readable to hug it with its operands. The main exception to this is when its operands are non-trivial in which case the power operator will not hug, the rule for this is the following:

> For power ops, an operand is considered "simple" if it's only a NAME, numeric CONSTANT, or attribute access (chained attribute access is allowed), with or without a preceding unary operator.

Fixes GH-538.
Closes GH-2095.

diff-shades results: https://gist.github.com/ichard26/ca6c6ad4bd1de5152d95418c8645354b

Co-authored-by: Diego <dpalma@evernote.com>
Co-authored-by: Felix Hildén <felix.hilden@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
13 files changed:
CHANGES.md
docs/the_black_code_style/current_style.md
src/black/linegen.py
src/black/trans.py
src/black_primer/primer.json
tests/data/expression.diff
tests/data/expression.py
tests/data/expression_skip_magic_trailing_comma.diff
tests/data/pep_572.py
tests/data/pep_572_py39.py
tests/data/power_op_spacing.py [new file with mode: 0644]
tests/data/slices.py
tests/test_format.py