Inconsistencies with tab/space indentation between Cygwin/Win32?

Chris Rebert clp2 at
Thu Aug 4 03:08:29 EDT 2011

On Wed, Aug 3, 2011 at 9:25 PM, Christian Gelinek
<cgelinek at> wrote:
> Hi all,
> I have a problem running some python program using version 2.6.4 (or version
> 2.7.2, I tried both) from the Win7 command line - it never finishes due to
> an infinite loop. The thing is, when I run the same program through Cygwin
> which uses Python version 2.6.5, it exits the loop at some point.
> I came to try this after I realised that in some of the sources (it is a
> rather big program using many source files, most of them being created by
> others from a Linux environment), the indentation is mixed tabs/spaces where
> the assumed tab size is 8 spaces.

That's just plain evil.

> Reading on the Python website, a tab size of 8 is default anyway, so I would
> have assumed it should work... does that mean that one tab equals 2
> indents?!? I myself never use tabs to indent Python code but let my editor
> do a tab-to-4-spaces conversion when I press <TAB>.
> I find it at least confusing to read that Python expects a tab size of 8 but
> at the same time uses 4 spaces for one indent level. Or maybe I am
> completely on the wron track here?

4-space indents are /recommended/ by PEP 8, but the interpreter does
not require or prefer that style. What the interpreter does when
parsing indentation is rather more complicated; see

You might wanna look at tabnanny:


More information about the Python-list mailing list