Separate tab continuation indents for function/conditional arguments
- Dominant language
- Python
- Stars
- 14k
- Forks
- 904
- PR merge metrics
- No merged PRs in 30d
Description
I like to stay pretty close to PEP 8, with the major exception that I use tabs. PEP 8 says that if you have to break function definitions/conditional arguments over multiple lines, you should indent it more than the body. For example:
``` python
# good:
def function(arguments_with, some_really, long_names, that_you,
would_have_to, split_over, multiple_lines):
pass
# bad:
def function(arguments_with, some_really, long_names, that_you,
would_have_to, split_over, multiple_lines):
pass
```
**I want my code to look like this:** (Here I use `| ` to denote a tab.)
``` python
def function(arguments_with, some_really, long_names, that_you,
| | would_have_to, split_over, multiple_lines):
| something = [
| | 'Some long strings that',
| | 'Would get split across lines'
| ]
```
However with `--style='{based_on_style: pep8, continuation_align_style: fixed, use_tabs: yes}'`, it indents lists/dicts with tabs, but doesn't indent function definition continuations extra, like this:
``` python
def function(arguments_with, some_really, long_names, that_you,
| would_have_to, split_over, multiple_lines):
| something = [
| | 'Some long strings that',
| | 'Would get split across lines'
| ]
```
If I set `CONTINUATION_INDENT_WIDTH: 8` it indents continuations the proper amount, but it _also_ indents list/dict bodies to the same amount (two tabs instead of one):
``` python
def function(arguments_with, some_really, long_names, that_you,
| | would_have_to, split_over, multiple_lines):
| something = [
| | | 'Some long strings that',
| | | 'Would get split across lines'
| ]
```
Is there an option to format code the way I want here, so I can (mostly) follow PEP 8 _and_ use tabs? Sorry if what I'm asking doesn't make any sense. In short I want dict/list bodies to be indented with one tab, and function _definition)/conditionals broken over lines to be indented with two tabs.
Contributor guide
Assessment
This issue has not been assessed yet.