Tabnanny really useful?

Franz Steinhaeusler franz.steinhaeusler at utanet.at
Tue Dec 21 06:09:54 EST 2004


On Tue, 21 Dec 2004 10:24:40 +0100, "Fredrik Lundh"
<fredrik at pythonware.com> wrote:

>Franz Steinhaeusler wrote:
>
>> Thanks for your explanation.
>>
>> I tried an found:
>> def a():
>> ->print
>> ->.print
>>
>> where point is a space.
>>
>> tabnanny here complains and python compile it just fine.
>
>really?  that's a syntax error (you cannot change indentation nillywilly
>inside a block), and the Python I'm using surely flags this as an error:
>
>$ python -c "print repr(open('franz.py').read())"
>'def a():\n\tprint\n\t print\n'
>
>$ python franz.py
>  File "franz.py", line 3
>    print
>    ^
>SyntaxError: invalid syntax
>
>while tabnanny gives it one thumb up:
>
>$ python -m tabnanny -v franz.py
>'franz.py': Clean bill of health.
>
>what Python version are you using?
>
></F> 
>
>

Oh sorry, I meant
def a():
->print
.->print

C:\Python23\Lib>tabnanny.py -v c:\franz.py
'c:\\franz.py': *** Line 3: trouble in tab city! ***
offending line: ' \tprint\n'
indent not equal e.g. at tab size 1

C:\Python23\Lib>python -c "print repr(open('c:/franz.py').read())"
'def a():\n\tprint\n \tprint\n'

C:\Python23\Lib>c:/franz.py

C:\Python23\Lib>
-- 
Franz Steinhaeusler



More information about the Python-list mailing list