Why not enforce four space indentations in version 3.x?

John Nagle nagle at animats.com
Tue Jul 14 14:06:17 EDT 2009


walterbyrd wrote:
> I believe Guido himself has said that all indentions should be four
> spaces - no tabs.
> 
> Since backward compatibility is being thrown away anyway, why not
> enforce the four space rule?
> 
> At least that way, when I get python code from somebody else, I would
> know what I am looking at, without having to do a hex dump, or
> something.

    Python 3 enforces the rule that you can't mix tabs and spaces
for indentation in the same file.  That (finally) guarantees that
the indentation you see is what the Python parser sees.  That's
enough to prevent non-visible indentation errors.

    It also means that the Python parser no longer has to have
any concept of how many spaces equal a tab.  So the problem
is now essentially solved.

					John Nagle



More information about the Python-list mailing list