Indentation style...

Ken Peek Peek at LVCM.comNOSPAM
Sun May 27 19:52:59 CEST 2001


Python allows the use of spaces or tabs (but not both!) to indent with.  I think
this was a mistake.  I think tabs should be forced at the beginning of lines,
and spaces should be forced after the first printable character is typed.  The
exception to this rule would be an empty line, and multiline strings.

This indentation strategy would then be enforced by the interpreter/compiler.

This will allow the programmer to set their editor to display a tab at whatever
indentation spacing they like, and the original structure (which is part of the
documentation of the code) is preserved.

Most people that try Python at first hate it's indentation paradigm.  BUT--
after a while they get used to it, then start liking and appreciating it very
much.  I think the reason is that on a large project with many programmers, the
code has a tendency to kind of "look the same"-- making the code written by
others easier to read and understand.

Forcing tabs on the beginning of lines, and forcing spaces (for white space)
after the first printable character (except for null lines and multiline
strings) would be consistent with the philosophy of forcing "highly readable"
code to be generated.

Comments?






More information about the Python-list mailing list