[issue35957] Indentation explanation is unclear

Jérôme LAURENS report at bugs.python.org
Tue Feb 12 08:00:45 EST 2019


Jérôme LAURENS <jerome.laurens.dev at gmail.com> added the comment:

To be more precise, consider code

def f(x):
       \tx=0 # 7 spaces + one tab
        return x # 8 spaces

In cpython, both indentation levels are 8 and no indentation error is reported (this is the case where both tab size and alt tab size are equal)

If instead of 8 the tab would count for 6 spaces, then we would have 12 and 8 as indentation level, resulting in a mismatch and an indentation error being reported, according to the documentation. This is inconsistent.
Then either the documentation is faulty or cpython is.

Actually, cpython accepts a mix of space and tabs only when tabs are in 8, 16, 24... positions.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35957>
_______________________________________


More information about the Python-bugs-list mailing list