PEP8 and 4 spaces

Marko Rauhamaa marko at pacujo.net
Tue Jul 8 07:13:09 EDT 2014


Chris Angelico <rosuav at gmail.com>:

> Not quite; tools like diff that put a character at the beginning of
> the line are likely to be tab-aware,

No, just tried it again: diff outputs tabs as tabs.

   $ diff abc def
   1,2c1,2
   <       abc
   <         abc
   ---
   >       def
   >         def

where line 1 begins with a tab and line 2 begins with 8 spaces in each
file.

> and gcc is certainly going to comprehend them

   $ gcc -c test.c
   test.c:1:2: error: expected identifier or ‘(’ at end of input

where test.c contains

   <TAB>(<LF>

IOW, gcc reports that the open parenthesis is in column 2.

> (at least to the extent of treating them as whitespace).

Sure, but that doesn't concern the tab stops in any way.

> And I think less takes notice of them, too,

How?

> so it's only the very simplest tools like cat that actually ignore
> them or treat them as single characters (or even bytes).

They all seem to be "simple." At least Python is:

   $ python3 -c 'print	('
     File "<string>", line 1
       print	(
             ^
   SyntaxError: unexpected EOF while parsing

where the caret is pointing at the wrong visual column.


Marko



More information about the Python-list mailing list