allow line break at operators

Seebs usenet-nospam at seebs.net
Fri Aug 12 12:33:12 EDT 2011


On 2011-08-12, Ben Finney <ben+python at benfinney.id.au> wrote:
> Seebs <usenet-nospam at seebs.net> writes:
>> 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*.

> What a strange limitation. Why are you not comparing apples with apples?

I am trying to.  I'm trying to compare C-like languages, with braces, to
Python, with indentation.

> The correct comparison would be ???getting the braces to match the
> intended structure??? compared with ???getting the indentation to match the
> intended structure???.

Right.

I have seen Python programs in which indentation, while it obviously matched
what actually happened, did not match intent.  It is (at least in principle)
easier to debug because you can see that, but...

I've seen people in C do stuff like:

	for (i = 0; i < N; ++i);
		a[i] = 0;

This is clearly a case where indentation matches intent, but doesn't match
functionality, because C allows indentation to not-match functionality; this
is the famous problem Python is solving.

However, I've never, ever, seen a problem like that *when people were using
braces*.

An apples-to-apples comparison between indentation and braces should be a
comparison *to braces*, not to people who "cleverly" omit braces.

(If you are looking for a debate on whether C's optional-braces are a good
idea, I'm afraid you will have to look elsewhere; if it were up to me, I
would totally approve a language change making them mandatory.)

> As you say, the data is thin on the ground for this issue. Would you
> accept the charge that you're being just as dogmatic about the
> superiority of braces-as-block-syntax?

I don't think so.

> If not, what makes your position less dogmatic than ours?

A couple of things.

1.  I do assert that people who are happy with an editor and have been using
it for twenty years ought to change their editor to accommodate a language
which uses braces.
2.  I will happily grant that braces, written legibly, cost you an extra
line per block, and that this space cost can make it harder to see all the
code at once.
3.  I don't have a problem agreeing that there certainly appear to be people
for whom the Python syntax is easier to read.

I think #1 is the real point at which I think there's a dogmatism problem.
Maybe editors shouldn't "helpfully" convert spaces to tabs, but that feature
has been nearly entirely beneficial to me in everything else I've edited
for a long time, and I don't *want* to learn a new editor just for one
language.

-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