allow line break at operators

Seebs usenet-nospam at seebs.net
Fri Aug 12 02:34:00 EDT 2011


Before I get to the rest of this:

Thinking it through, I've been unreasonable and grumpy here, and I'm trying
to figure this out a bit more.

A general observation:  There's no real data here, so far as I can tell.
There is no pair of languages which are exactly identical except for whether
they use whitespace or some kind of brace/bracket/thing to indicate blocks,
such that we can compare results between them.  Humans are *notoriously*
unreliable at evaluating the ease with which they do things, how long it
takes them, how many mistakes they're making, and so on...

So really, this is probably in large part a matter of taste or preference.

On 2011-08-11, Ethan Furman <ethan at stoneleaf.us> wrote:
> The times that whitespace indentation has bitten me, it was still not 
> difficult to fix -- I just had to look and see which line(s) 
> should/should not be where they were.

I've been thinking about this, and I just plain can't understand how this
could, in general, be done.  Given a bunch of lines of code with no indication
of where the blocks were supposed to be, I can't figure how this could be
"fixed" in a way that is not-difficult, at least in general.

> Not so.  If the braces do not match /intent/ (which is the problem I 
> care most about) then it cannot be fixed by machine.

Question for y'all:

Has anyone here ever ACTUALLY encountered a case where braces -- not
indentation -- did not match intent in a C-like language?  I'm talking
only about cases where braces are *actually present*.

I haven't.  Now, I've only been using C for maybe 20-25 years, but in all
that time, I have never, ever, not *once*, seen braces not match intent.
I've seen indentation errors galore.  I've seen nutjobs writing "}}}" on
a line all by itself.  I've seen people forget to add braces and do stuff
like:
	else
		a();
		b();

... but I've never, ever, seen braces not match intent.  It just hasn't ever
happened in code I've seen.

>> people who'd picked Python for some stuff I have to work for, point out the
>> hostility of the Python community to newcomers whose workflows don't happen
>> to have been preemptively built entirely around Python's design decisions,
>> and suggest that maybe we use another language.  Heck, since I've been
>> encouraged so much to do so, I think I will.

> Your choice, obviously -- seems a shame to me, though, to give up on 
> Python because of one or two ouchy areas on c.l.py.  By and large it's a 
> very helpful and courteous community.

I was thinking about this more, and I think the issue that's historically
bugged me is this:

Most of the people I know and talk to about programming languages regard
preferences as a matter of personal taste.  I've seen people say that they
prefer the significant-indentation thing, and I've seen people say they
dislike it.

The Python community, as a whole, seems particularly dogmatic about the
indentation thing.  And coming here as someone who doesn't much like it,
and has been bitten by it a few times...

Imagine that I were taking care of a cat for the first time, and I came to
a cat-owners newsgroup, and found the following:

1.  Nearly everyone there hated dogs, utterly.
2.  The people who hated dogs were snide and insulting about people who
didn't hate dogs.

... oookay, then.  So I post my question, about a cat peeing on a bed, and
I get the following responses:

1.  What kind of idiot are you to continue using a broken non-waterproof
matress?  You should be using a solid vinyl cover over your mattress to
prevent it from geting cat pee.
2.  Once you've had a cat for a while you'll find that overall cat pee is
superior to a dry mattress.

... At this point, I'm not exactly going to feel like a welcome member of the
community.  :)

Now, that analogy is a little extreme, perhaps, but...  Programmers get
attached to their editors.  And having a bunch of people insist that it's
crazy of me to use an editor which has worked perfectly for me in the other
ten programming languages I use, with settings that are not merely tolerable
but *mandatory* for at least one of them, is... well, it doesn't create the
impression that people who don't happen to already have fallen in love with
an editor that coexists well with the whitespace thing are welcome.

And part of this really is personal taste.  I *LIKE* having a matching outdent
for everything.  I like to look at code and see
	blah
		blah
			blah
		blah
	blah

because then I know it's balanced.  If one of them is missing, *something is
wrong*.  And I have to keep that instinct to stay functional in most of the
other languages I know.  I don't have the option of ceasing to use C, but if
I used C and didn't watch for missing close-braces, I'd be pretty badly hosed.

So I have this strong incentive to prefer an explicit thing that I can see.
And in any event, I *do* prefer it.

In other language communities, when I find things about the language
troublesome, I usually find people offering suggestions for ways to improve
things, or workarounds, or acknowledging that, yes, that can be annoying.
But for some reason, in this one, that's apparently against a local taboo.
So instead of acknowledging that it is conceivably possible for people to
prefer different things, people say things like "oh, once you've done it a
bit you'll realize how much better it is and then you'll love it".
Condescending, smug, and, at least so far, *totally untrue* for me.

I am also weirded out by the claim that a Python which used braces would no
longer be Python in any way, shape, or form.  If you were to make a C
derivative which used indentation instead of braces (this should be trivial
to do with a preprocessor), I can't imagine C programmers claiming it's
"not C".  Of course it's C; it has the C type system, the C operators, the
C promotion rules, C linkage and scope and so on... That's C.  It's just a C
variant which tweaks the punctuation.

If Python with braces wouldn't be Python at all, why on earth does the
language even exist?  If all you want is indentation-which-matters, it's
super easy to write a preprocessor for ANY language to do that, and you could
have every last positive feature, benefit, or valuable trait of Python by
doing that to any other language.

Unless, of course, there are *other* things that are significant
about Python.  In which case, a language which preserved all of
those, but used braces, would still be a kind of Python after all.

Long story short:  I think the dismissiveness and hostility I've seen from
people in the Python community towards people who, for *whatever* reason,
find the indentation-flow-control thing annoying, is not really helping the
Python community win converts.  All the people yelling at me and insulting
my choice of editors, and telling me I should control every mail server
between me and anyone who will ever send me code, have done nothing at all
to make me feel like this is a language community I'd like.  Meanwhile, the
Python users I've talked to elsewhere who have funny indentation war stories
but say that over time they've gotten used to it and they like how the code
looks have made it sound like the language might be sorta fun.

-s
-- 
Copyright 2011, all wrongs reversed.  Peter Seebach / usenet-nospam at seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
I am not speaking for my employer, although they do rent some of my opinions.



More information about the Python-list mailing list