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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update preview style docs to include recent changes #3136

Merged
merged 5 commits into from Jun 27, 2022
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 19 additions & 7 deletions docs/the_black_code_style/future_style.md
Expand Up @@ -52,25 +52,37 @@ tracked in [this issue](https://github.com/psf/black/issues/2188).

### Removing trailing newlines after code block open

_Black_ will remove trailing newlines after code block openings. That means that the
following code:
_Black_ will remove trailing newlines after code block openings. For example:

```python
def my_func():

print("The line above me will be deleted!")

print("But the line above me won't!")
felix-hilden marked this conversation as resolved.
Show resolved Hide resolved
```

Will be changed to:
will be changed to:

```python
def my_func():
print("The line above me will be deleted!")

print("But the line above me won't!")
```

This new feature will be applied to **all code blocks**: `def`, `class`, `if`, `for`,
`while`, `with`, `case` and `match`.

### Improved parentheses management
felix-hilden marked this conversation as resolved.
Show resolved Hide resolved

_Black_ will format parentheses around return annotations, `await` expressions and
`with` statements similarly to other sets of parentheses. For example:
felix-hilden marked this conversation as resolved.
Show resolved Hide resolved

```python
with ((open("bla.txt")) as f, open("x")):
pass
```

will be changed to:

```python
with open("bla.txt") as f, open("x"):
pass
```