do people really complain about significant whitespace?

I

infidel

Where are they-who-hate-us-for-our-whitespace? Are "they" really that
stupid/petty? Are "they" really out there at all? "They" almost sound
like a mythical caste of tasteless heathens that "we" have invented.
It just sounds like so much trivial nitpickery that it's hard to
believe it's as common as we've come to believe.
 
J

Jason

infidel said:
Where are they-who-hate-us-for-our-whitespace? Are "they" really that
stupid/petty? Are "they" really out there at all? "They" almost sound
like a mythical caste of tasteless heathens that "we" have invented.
It just sounds like so much trivial nitpickery that it's hard to
believe it's as common as we've come to believe.

I have a coworker who dislikes Python for the whitespace. He likes the
idea that if someone is silly enough to put a whole program on one
line, they can put it back together by following the braces. He also
likes that the compiler can compile the program even if a normal person
can't read it.

I've pointed out that we format our code with the whitespace anyway.
He points out that if some code gets accidentally dedented, it is
difficult for another programmer to determine which lines were supposed
to be in the indented block. I pointed out that if someone
accidentally moves a curly brace, the same problem can occur.
Anecdotally, I've never had either problem.

Sadly, people who do dislike the whitespace do exist. I have also
talked with several other programmers who were very turned off about
the white-space thing and wouldn't give the language a chance.

Eric S. Raymond wrote enthusiastically about Python, but was initially
turned off by the whitespace rules. (See
"http://www.python.org/about/success/esr/" for details.)

I personally love that my logically formatted code imparts information
logically to the language.

(I haven't seen a good hate-us-for-our-whitespace thread go on for
awhile. I do remember some good "We like Python, Now Add Our Favorite
C/C++/LISP/INTERCAL Features or We'll Leave" threads on this newsgroup.)
 
C

crystalattice

infidel said:
Where are they-who-hate-us-for-our-whitespace? Are "they" really that
stupid/petty? Are "they" really out there at all? "They" almost sound
like a mythical caste of tasteless heathens that "we" have invented.
It just sounds like so much trivial nitpickery that it's hard to
believe it's as common as we've come to believe.

Actually, some of the guys I work with complained about Python when
they first had to learn it for our Zope server. One of them is an
old-school Unix guy who spent the last 20+ years doing procedural
languages with funky syntax, like C. The other one is a VB.NET junkie
who I don't think has much experience outside of MS languages, except
maybe Java.

One of the complaints they had for the first few weeks was the white
space issue and the fact Python doesn't have brackets or semicolons.
Obviously they learned to "deal with it" but they sure made it seem
like it was a painful transition. I think the biggest pain was the
fact that they are forced to indent their code now so they can't be
lazy anymore.
 
J

John Machin

infidel said:
Where are they-who-hate-us-for-our-whitespace? Are "they" really that
stupid/petty? Are "they" really out there at all? "They" almost sound
like a mythical caste of tasteless heathens that "we" have invented.

All societies demonise outsiders to some extent. It's an unfortunate
human (and animal) trait. In some societies, this is directed from the
top. Very fortunately, this is AFAICT not the case in the Python
community.
It just sounds like so much trivial nitpickery that it's hard to
believe it's as common as we've come to believe.

So just block your ears when the propaganda vans with the loud-speakers
on top drive past your dwelling :)

........................................

However, meaninglessly significant whitespace at the *other* end of a
line can be annoying:

#>>> a = \
.... 1
#>>> a
1
#>>> b = \
File "<stdin>", line 1
b = \
^
SyntaxError: invalid token

Huh? Can't see what the problem is? Maybe this exaggerated example may
help:

#>>> c = \
File "<stdin>", line 1
c = \
^
SyntaxError: invalid token

Cheers,
John
 
B

bearophileHUGS

Jason said:
He points out that if some code gets accidentally dedented, it is
difficult for another programmer to determine which lines were supposed
to be in the indented block. I pointed out that if someone
accidentally moves a curly brace, the same problem can occur.

I like significant whitespace, but a forum, newsgroup manager (like
Google Groups in the beginning), email management program, blog comment
system, etc, may strip leading whitespace, and it usually doesn't
"move" braces. A language (like Python) doesn't exist alone in vacuum,
it exists in an ecosystem of many other programs/systems, and if they
don't manage leading whitespace well, such language may have some
problems :)

Bye,
bearophile
 
J

Jason

I like significant whitespace, but a forum, newsgroup manager (like
Google Groups in the beginning), email management program, blog comment
system, etc, may strip leading whitespace, and it usually doesn't
"move" braces. A language (like Python) doesn't exist alone in vacuum,
it exists in an ecosystem of many other programs/systems, and if they
don't manage leading whitespace well, such language may have some
problems :)

Bye,
bearophile

Certainly, you are correct. Most of the time, I zip up any source code
for email purposes. But newsgroup managers are certainly an issue.
For comment thingies online, the preformat tag is your friend, too.

It is annoying that certain communication channels do not respect
white-space. I dislike using braces because I have to indicate my
intentions twice: once for the compiler and once for humans.

In the situations where I use Python, though, I haven't had a problem.
In the situations where my coworker is using Python (code updates
through CVS), he also shouldn't have a problem.
 
B

Ben Finney

infidel said:
It just sounds like so much trivial nitpickery that it's hard to
believe it's as common as we've come to believe.

As others have pointed out, these people really do exist, and they
each believe their preconception -- that significant whitespace is
intrinsically wrong -- is valid, and automatically makes Python a
lesser language.

One of the most stupid language-definition decisions that most people
have come across is the Makefile format. If you're not familiar with
it, spaces and tabs are *each* significant. Specifically, putting
spaces where a tab is required will result in a file that, while it
may be visually identical to a correctly formatted file, doesn't parse
correctly. In hindsight it's trivial to predict the needlessly painful
learning process that ensues.

This is a very painful memory for many programmers, and the general
opinion that results is "syntactically significant whitespace is
bad". This is the phrase that always gets brought out, and it's often
clear that the person hasn't considered *why* it's bad.

The issue with the Makefile format (lampooned wonderfully by the
Whitespace programming language) is that *invisible* differences in
whitespace should not be significant. In a Makefile, you *must* mix
spaces and tabs in the same file; this leaves the door wide open to
invisible differences. In Python, an admonishment of "always indent
each file consistently" suffices.

Hope that goes some way to explaining one possible reason why rational
people can consistently react in horror to the issue.
 
B

bearophileHUGS

Jason said:
But newsgroup managers are certainly an issue.
For comment thingies online, the preformat tag is your friend, too.

Time ago I used to add a | or something similar at the beginning of
lines, to avoid the leading whitespace stripping done by Google Groups.
Other (silly) solutions are to add explicitely the number of indents at
the beginning of a line (2 digits suffice), or to even add explicit
#end comments just under the dedents, so a script can read such ending
comments and reconstruct the original Python indentations... (lines
splitted with \ and similar require some extra care).

Bye,
bearophile
 
J

Jim

He points out that if some code gets accidentally dedented, it is
difficult for another programmer to determine which lines were supposed
to be in the indented block. I pointed out that if someone
accidentally moves a curly brace, the same problem can occur.
Anecdotally, I've never had either problem.
I have many times found that in moving a multi-screen block of code
from one place to another (where the indent is less or more) then I
have trouble re-indenting the code. That is not to say that I don't in
the end prefer the significant whitespace, but I have had errors moving
code like:
if ..
try:
..
except
..
else ..
where it wound up (with the help of the emacs tab key) as
if ..
try:
..
except
..
else ..
.. I attempt to be careful, but certainly it has happened to me.

Jim
 
M

Michiel Sikma

Op 8-aug-2006, om 1:49 heeft Ben Finney het volgende geschreven:
As others have pointed out, these people really do exist, and they
each believe their preconception -- that significant whitespace is
intrinsically wrong -- is valid, and automatically makes Python a
lesser language.

Well, I most certainly disagree with that, of course, but you gotta
admit that there's something really charming about running an auto-
formatting script on a large piece of C code, turning it from an
unreadable mess into a beautifully indented and organized document. I
actually sometimes intentionally programmed ugly code so that I could
do that. I kind of miss it. :)

Michiel
 
G

gslindstrom

infidel said:
Where are they-who-hate-us-for-our-whitespace? Are "they" really that
stupid/petty? Are "they" really out there at all? "They" almost sound
like a mythical caste of tasteless heathens that "we" have invented.
It just sounds like so much trivial nitpickery that it's hard to
believe it's as common as we've come to believe.

Some of it may be a reaction from "old-timers" who remember FORTRAN,
where (if memory serves), code had to start in column 16 and code
continutations had to be an asterik in column 72 (it's been many years
since I've done any work in FORTRAN, but you get the idea)

Or it may be a reaction from Assembler, which is also quite
column-centric (is Assembler still taught in schools??).

But most likely, it's different. It's easier to complain about things
than to actually check them out. Recently I had a friend tell me that
they absolutely hated a certain tv personality/author. When I asked if
they had ever watched the person or read one of their books, they said
"Why should I? I hate them!!". I think the same attitude comes into
play with computer languages.

One more thing. I have many friends that love to program Perl.
Without bashing the language, I find it ironic when they say "There's
more than one way to do it" but inisit that I should be using Perl
while they quote Python as "There's only one way to do it" though
(most) Python coders I know are fairly comforatble dealing with
multiple languages.

--greg
 
I

infidel

One of the most stupid language-definition decisions that most people
have come across is the Makefile format.

Hope that goes some way to explaining one possible reason why rational
people can consistently react in horror to the issue.

Ah, thanks for that. This peek into history makes the irrational fear
of significant whitespace seem a little less irrational.
 
I

infidel

All societies demonise outsiders to some extent. It's an unfortunate
human (and animal) trait.

Which is why I questioned it.
So just block your ears when the propaganda vans with the loud-speakers
on top drive past your dwelling :)

Funny how using python makes me feel like a member of some kind of
rebellion against the empire. Where I work it's all VB, VB.NET, and
ASP.NET. I've been the lone voice in the wilderness for so long that
I've become an inside joke. I actually have a certificate that says
"Most likely to re-write the system in Python".

*sigh*
 
T

Thomas Guettler

Am Mon, 07 Aug 2006 14:43:04 -0700 schrieb infidel:
Where are they-who-hate-us-for-our-whitespace? Are "they" really that
stupid/petty? Are "they" really out there at all? "They" almost sound
like a mythical caste of tasteless heathens that "we" have invented.
It just sounds like so much trivial nitpickery that it's hard to
believe it's as common as we've come to believe.

I like python, but sometimes i don't like that python allows
spaces and tabs. It would be easier if you had less choice and
must use four spaces.

That's one small argument against the current whitespace syntax in python.

Thomas
 
A

Alex Martelli

Some of it may be a reaction from "old-timers" who remember FORTRAN,
where (if memory serves), code had to start in column 16 and code
continutations had to be an asterik in column 72 (it's been many years
since I've done any work in FORTRAN, but you get the idea)

Column 7 was the start, 6 the one for continuation; 1-5 and 73-80 were
ignored by the compiler and could be used for numbering, grouping &c.
Been many years in my case, too, but as I was a mainly-Fortran guru for
several years in my career, it's hard to forget;-).
Or it may be a reaction from Assembler, which is also quite
column-centric (is Assembler still taught in schools??).

I never used a column-centric Assembler: even the first assemblers I
used, in the '70s (6502, Z80, a mini called HP1000, VAX/VMS when it was
just out, BAL/370, ...) were all column-indifferent. The HP1000 did not
even have a punched-card reader: it used punched _tape_ instead (quite a
popular device then, as it came with teletypes typically used as
consoles), so keeping track of columns would have a royal mess:).

I'm pretty sure you're still _able_ to take SOME Assembler-based course
in most universities, but you need to strive pretty hard for the
purpose... it's definitely not in the "default curriculum", even for
EEs, much less CSs.


Alex
 
A

Aahz

Where are they-who-hate-us-for-our-whitespace? Are "they" really that
stupid/petty? Are "they" really out there at all? "They" almost sound
like a mythical caste of tasteless heathens that "we" have invented.
It just sounds like so much trivial nitpickery that it's hard to
believe it's as common as we've come to believe.

When I put on my Python evangelist hat, I do get complaints about that
regularly.
--
Aahz ([email protected]) <*> http://www.pythoncraft.com/

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it." --Brian W. Kernighan
 
A

Andy Dingley

Thomas said:
I like python, but sometimes i don't like that python allows
spaces and tabs. It would be easier if you had less choice and
must use four spaces.

That's the nice thing about Python. It doesn't care about indentation
distance, it just wants "some" and "consistent".

I like the idea that "humans see the whitespace as significant anyway,
so document the fact and use it" (I presume this came from Occam).
What I don't like so much is that the _ends_ of blocks are less
visually obvious.
 
D

Dennis Lee Bieber

Some of it may be a reaction from "old-timers" who remember FORTRAN,
where (if memory serves), code had to start in column 16 and code
continutations had to be an asterik in column 72 (it's been many years
since I've done any work in FORTRAN, but you get the idea)
Comment C in column 1
(often extended to accept OS JCL markers too)
Label numeric in 1-5
Continuation anything in column 6
(DEC, if using tab indents would take "<tab>&")
Statement column 7-72
Sequence/ID column 73-80

I forget what COBOL used, but it had a few fields of its own.
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/
 
G

Gerhard Fiedler

When I put on my Python evangelist hat, I do get complaints about that
regularly.

Being new to Python, and the indenting thing being the one feature that
convinced me to take a serious look at Python, there's almost only one
conclusion for me: they must not like self-documenting code... :)

Gerhard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top