Indentations and future evolution of languages

Kurt Smith kwmsmith at gmail.com
Tue Mar 10 17:04:57 EDT 2009


On Tue, Mar 10, 2009 at 12:39 PM,  <skip at pobox.com> wrote:
>
>
>    John> The only complaint I have there is that mixing tabs and spaces for
>    John> indentation should be detected and treated as a syntax error.
>
> Guido's time machine strikes again (fixed in Python 3.x):
>
>    % python3.0 ~/tmp/mixed.py
>      File "/home/titan/skipm/tmp/mixed.py", line 3
>        print(a)
>               ^
>    TabError: inconsistent use of tabs and spaces in indentation

Or just use the '-tt' command line switch to force indentation consistency:

ksmith at work:~/tmp [366]$ python2.5 -tt mixed.py
  File "mixed.py", line 6
    print a
          ^
TabError: inconsistent use of tabs and spaces in indentation


Kurt



More information about the Python-list mailing list