New submission from Mikko Rantalainen <mikko.rantalai...@peda.net>: Contrary to PEP-8 (https://www.python.org/dev/peps/pep-0008/#tabs-or-spaces) claiming "Python 3 disallows mixing the use of tabs and spaces for indentation", in reality Python 3 allows mixing tabs and spaces without warnings or errors. For example (with all spaces replaced with middle dot and all spaces replaced with a short arrow):
#!/usr/bin/python3 for·i·in·range(2): ··for·j·in·range(3): ➧··for·k·in·range(4): ·➧···print(i,j,k,sep=",") Either the PEP-8 should be fixed or the parser/compiler should be fixed. The current behavior seems a bit unstable because the exact order of spaces and tabs causes "TabError: inconsistent use of tabs and spaces in indentation" to appear more or less random. I'd prefer python3 to require that *all whitespace* at the start of the all the lines is tabs for the whole file or spaces for the whole file. And first indented line sets the preference for the whole file. (Personally I'd prefer tabs contrary to PEP-8 language but this bug is not about the preference. This is PEP-8 claiming things that are not true.) $ python3 --version Python 3.5.2 ---------- components: Interpreter Core messages: 354779 nosy: Mikko Rantalainen priority: normal severity: normal status: open title: Python3 allows mixture of tabs and spaces for indentation versions: Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38496> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com