Compare source code

Mark Wooding mdw at distorted.org.uk
Thu Nov 4 14:48:05 EDT 2010


Tim Harig <usernet at ilthio.net> writes:

> So, your telling me that mixing tabs and spaces is considered a good
> practice in Haskell?

It doesn't seem to be a matter which is discussed much.  I think Haskell
programmers are used to worrying their brains with far more complicated
things like wobbly[1] types.

> I would argue that text files do not have tab stops -- text editors
> do.  So long as you use tabs for all of your indenting, it is quite
> safe to set the editors tab stops however one likes since the editor's
> tab stop doesn't effect the output of the file.

This is wishful thinking.  Firstly, code written with a narrow
indentation offset (e.g., two spaces) can take up an uncomfortable width
when viewed with a wider offset.

Secondly, if you want other parts (e.g., per-line comments) of lines
with different indentations to align, then you'll have to take into
account the tab width.  Technically, you could arrange that between any
pair of alignment points of any pair of lines there are the same number
of tab characters; but this is also doomed to uncomfortably wide lines;
it also suffers because it imposes an /a priori/ upper bound on the
indentation level.

[1] Proper technical term.  I kid you not.

-- [mdw]



More information about the Python-list mailing list