C's syntax (was Re: Python Formatted C Converter (PfCC))

Andrew Dalke dalke at acm.org
Mon Oct 23 15:58:20 EDT 2000


Toby Dickenson wrote:
>Python's syntax is 'pretty good' yet I would advocate a python
>compiler (or compileall.py) to give warnings like tabnanny.

$ cat > test.py
if 1:
  if 1:
    if 1:
      if 1:
        print "spaces"  # there are 8 spaces starting this line
        print "tab"     # there is a single tab (which looks like 8 spaces)
here
^D
$ python test.py
spaces
tab
% python -t test.py
test.py: inconsistent tab/space usage
spaces
tab
[dalke at pw600a ~]$ python -tt test.py
  File "test.py", line 6
    print "tab"
              ^
SyntaxError: inconsistent use of tabs and spaces in indentation
$

(Did I hear the time machine just now? :)

                    Andrew
                    dalke at acm.org






More information about the Python-list mailing list