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

Fix alignment no 3 spaces #444

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions episodes/15-coding-conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,33 +138,33 @@ or a hanging indent.
```python
# Add an extra level of indentation (extra 4 spaces) to distinguish arguments from the rest of the code that follows
def long_function_name(
var_one, var_two, var_three,
var_four):
print(var_one)
var_one, var_two, var_three,
var_four):
print(var_one)


# Aligned with opening delimiter
foo = long_function_name(var_one, var_two,
var_three, var_four)
var_three, var_four)

# Use hanging indents to add an indentation level like paragraphs of text where all the lines in a paragraph are
# indented except the first one
foo = long_function_name(
var_one, var_two,
var_three, var_four)
var_one, var_two,
var_three, var_four)

# Using hanging indent again, but closing bracket aligned with the first non-blank character of the previous line
a_long_list = [
[[1, 2, 3], [4, 5, 6], [7, 8, 9]], [[0.33, 0.66, 1], [0.66, 0.83, 1], [0.77, 0.88, 1]]
]
[[1, 2, 3], [4, 5, 6], [7, 8, 9]], [[0.33, 0.66, 1], [0.66, 0.83, 1], [0.77, 0.88, 1]]
]

# Using hanging indent again, but closing bracket aligned with the start of the multiline contruct
a_long_list2 = [
1,
2,
3,
# ...
79
1,
2,
3,
# ...
79
]
```

Expand All @@ -189,11 +189,11 @@ to indicate line continuation (slightly less preferred method).
```python
# Using delimiters ( ) to wrap a multi-line expression
if (a == True and
b == False):
b == False):

# Using a backslash (\) for line continuation
if a == True and \
b == False:
b == False:
```

### Should a Line Break Before or After a Binary Operator?
Expand Down