Compare source code

Seebs usenet-nospam at seebs.net
Thu Nov 4 00:09:10 CET 2010


On 2010-11-03, Steven D'Aprano <steve-REMOVE-THIS at cybersource.com.au> wrote:
> Yes. How does that contradict what I said?

Once you understand that you do have to break the rules occasionally,
it is a good idea to design things that will be robust when the rules
are broken.

> Ah, argument by misunderstanding the Zen!

I see.  So explicit boundaries are a good thing, except when they are
one specific special case.

Let us imagine a hypothetical mirror-universe person, who is otherwise
like you, but:

1.  Has a goatee.
2.  Actually hates the indentation rules, wishes Python had braces,
but has become emotionally invested in defending the status quo because
if he had to suffer, dammit, everyone else should have to suffer too.

You have not yet made a single argument that he wouldn't have made
too.

>> It is *better* to explicitly mark the
>> ends of things than to have it be implicit in dropping indentation. 
>> That's not a burden, it's good engineering practice.

> Python does explicitly mark blocks. It does it by changes in indentation. 
> An indent is an explicit start-block. An outdent is an explicit end-
> block. There is nothing implicit in a change in indent level.

What's the token that marks the end of a block, corresponding to the
colon used to introduce it?

> It simply isn't possible to have implicit start/end block markers, unless 
> you restrict your language in ways that exclude most blocks. E.g. if all 
> if blocks were restricted to a single statement, then you could have an 
> implicit block -- the block in one statement. Stating that Python uses 
> implicit block markers is simply wrong.

No, it isn't.  There's no token telling you where the block ended.

C *allows* implicit blocks, and this is widely regarded as a key flaw.
However, it also allows you to explicitly mark blocks in a way which
is robust against common errors, allowing software to automatically
fix up differences between, say, competing indentation styles.

-s
-- 
Copyright 2010, 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