Compare source code

Tim Harig usernet at ilthio.net
Thu Nov 4 13:45:58 EDT 2010


On 2010-11-04, Mark Wooding <mdw at distorted.org.uk> wrote:
> Tim Harig <usernet at ilthio.net> writes:
>
>> Python is the only language that I know that *needs* to specify tabs
>> versus spaces since it is the only language I know of which uses
>> whitespace formating as part of its syntax and structure.
>
> You need to get out more.  Miranda, Gofer, Haskell, F#, make(1), and

I have never heard of Gofer.

I have heard the name Miranda and I know that it is a (purely?) functional
language; but, that is all that I know.

I took a cursory look at Haskell a while back; but, I ultimately chose to
learn Erlang instead as its error management constructs had real world
application for me.

I also looked at F# and Scala; but, neither are really applicable on my
chosen platform.  With F# being such a new language, I suspect that it
borrowed its indent practices either from Haskell or from Python.

I already introduced the make tab oriented syntax and Seebs has labeled it
as a major anti-pattern.

I am also aware of other langauges such as Boo; but, I don't really
consider them individually relevant to the conversation as they are
explicitly using a Python based syntax.  For this discussion I merely group
them with Python.

>> Mixed usage may be annoying in other languages; but, it breaks Python.
>
> I disagree.  The Haskell '98 report specifies (correctly) that tabs are
> every eight columns, and a tab moves to the next tab stop.  Python makes
> the same specification; it's just the users who actually want to stamp
> out tabs.

So, your telling me that mixing tabs and spaces is considered a good
practice in Haskell?  No, mixing tabs and spaces in Python isn't illegal;
but, I have never seen good outcomes from doing so.  No matter how you
define a tab, most people do not have their editor configured to show them
the difference between a tab stop and the equivilant number of spaces.
I have never experienced ill effects from using tabs alone.

> Flamebait: it's not the tabs that cause the problem: it's that some
> people are under the mistaken impression that the position of tab stops
> in text files is a matter for local preference.

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.  That way, everybody can edit their code
using an apparent indent level that is comfortable for them without being
disruptive to the code.  It is a win-win situation for everybody.



More information about the Python-list mailing list