This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Strict indentation in Python3
Type: enhancement Stage:
Components: Interpreter Core Versions: Python 3.3, Python 2.7
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: Arfrever, Sworddragon
Priority: normal Keywords:

Created on 2013-11-08 07:33 by Sworddragon, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test Arfrever, 2013-11-08 07:45
Messages (3)
msg202408 - (view) Author: (Sworddragon) Date: 2013-11-08 07:33
Python 2 provided this command line option:

"-t     Issue a warning when a source file mixes tabs and spaces for indentation in a way that makes it depend on the worth of a tab expressed in spaces.  Issue an error when the option is given twice."


I'm wondering why it doesn't exist anymore in Python 3. I wanted to make some tests to figure this out but I'm not able to trigger this behavior in Python 2. All my examples will result in throwing an exception with and without -tt or never throwing an exception with or without -tt. But I'm also having difficulties to understand what the second part of the sentence does mean. Can somebody maybe provide an example where "python2 -tt" will fail but "python2" not?
msg202409 - (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) * (Python triager) Date: 2013-11-08 07:45
Python 3 is intentionally stricter.

Try attached file.

$ python2.7 test
$ python2.7 -t test
test: inconsistent use of tabs and spaces in indentation
$ python2.7 -tt test
  File "test", line 3
    2
    ^
TabError: inconsistent use of tabs and spaces in indentation
$ python3.3 test
  File "test", line 3
    2
    ^
TabError: inconsistent use of tabs and spaces in indentation
msg202410 - (view) Author: (Sworddragon) Date: 2013-11-08 08:41
Thanks for the example, this is what I had in mind. Python 3 does also still provide the -t option (I'm assuming for compatibility reasons) but python3 -h and the manpage aren't saying about this.
History
Date User Action Args
2022-04-11 14:57:53adminsetgithub: 63724
2013-11-08 08:41:54Sworddragonsetmessages: + msg202410
2013-11-08 07:45:52Arfreversetstatus: open -> closed
files: + test

nosy: + Arfrever
messages: + msg202409

resolution: works for me
2013-11-08 07:33:28Sworddragoncreate