Indentation style...

Bernhard Herzog bh at intevation.de
Mon May 28 09:17:18 EDT 2001


Thomas Wouters <thomas at xs4all.net> writes:


> The interpreter will treat a tab as 8 spaces. Always.

Well, not exactly. The following code is syntactically correct (at least
in the sense that Python 2.1 doesn't produce a syntax error):

# tab-width:4

def f():
    a = 1      # four spaces indent
	b = 2  # one tab indent

The Python tokenizer recognizes various forms of the tab-width comment.
I'm not sure it's documented anywhere except in the sources.


  Bernhard

-- 
Intevation GmbH                                 http://intevation.de/
Sketch                                 http://sketch.sourceforge.net/
MapIt!                                               http://mapit.de/



More information about the Python-list mailing list