Depending on style in can be both.
+-- semantic
v
def something(with aligned,
list of,
parameters):
^
visual --+Example of what that does in practice: Lines that end up wrapping almost at the end of the soft-character-limit and look like this:
https://github.com/pennersr/django-allauth/blob/c9b31ddee81d...
If you're going to do that, the "correct" way would be to indent each parameter with tabs to the same depth as the function declaration, and then use spaces to take up the rest of the space (i.e. the width of the function declaration). Which is admittedly ugly - but it's ugly because it reflects the ugliness of misusing indentation for alignment. It's slightly less ugly if you use an editor that displays tabs and spaces differently - Kate/Kdevelop use a nice discreet » character for each level of indentation:
def hello_spam():
» while True:
» » print ("Hello",
» » "World")
The last line is visually aligned, but the semantic depth is the same. def hello_spam():
» while True:
» » print(
» » » "Hello",
» » » "World"
» » )(Whether visual alignment of this sort is desirable is a different question. If you want it then spaces are appropriate.)
PEP8 was only meant as a style guide for the python standard library. Although many have unfortunately taken it as a religious text.
And in Haskell. And in Nim. And in Haml. And in Sass. And in YAML.
https://en.wikipedia.org/wiki/Off-side_rule#Off-side_rule_la...
As for Python, it doesn't use space. It can use both spaces and tabs (but not mixed within the same file). It's just that PEP-8 require spaces, but not every project/library follow PEP-8.
"but editors will give you 4 spaces when you press tab" - yes, this one is a BS argument
But I've given up on discussing with people completely refractory to discussion, the cult of space indentation is strong
There is one consistency I'll concede: the consistency between indentation and tidying up the code, mixing tabs and spaces there is awful (as any mix of tabs and spaces are)
but what kind of editors do people use? Any normal editor supports autoindentation and you never get to press the damn tab key. In vim for example, if you set autoindent then you can map TAB to ESC, which is much closer.