code review

Chris Angelico rosuav at
Mon Jul 2 18:42:49 CEST 2012

On Tue, Jul 3, 2012 at 1:57 AM, Rick Johnson
<rantingrickjohnson at> wrote:
> Poor Chris. That's because you've been brainwashed into believing you
> must spoon feed your interpreter to get your code working correctly.
> Stop applying these naive assumptions to Python code. Python knows
> when you reach the end of a statement, no need for redundant
> semicolons! Python knows when its reached the end of block and needs
> to drop back one level, no need for redundant road signs.  Python
> knows Chris; Python KNOWS!

Why "poor", Ralph?

I am poor in the essence of ignorance's bliss, rich only in the
never-ending thirst for knowledge and more languages. In me there meet
a combination of antithetical elements which are at eternal war with
one another... I hope I make myself clear, lady?

Oops, wrong mailing list. Near enough.

Python is not magic. It's not that it "knows" when I reach the end of
a statement; it simply rules that line ends correspond to statement
ends unless ordered otherwise. It has been told that the reduction of
indentation level is a lexer token. Rick, do you realize that you have
to spoon-feed the interpreter with spaces/tabs when other interpreters
just KNOW to drop back an indentation level when you close a brace?


I simply need to make sure that the interpreter and I have the same
understanding of the code. It will then work correctly. There's
nothing special about one syntax or another, they're all just
communication from my brain to a CPU, and different syntaxes are
suited to different tasks. There's nothing inherently wrong with:

right_length = len(x) > 5, < 20

being a valid way of expressing a double condition. It puts the query
first and the bounds after it, so hey, it's justifiably sane. (No, I'm
not advocating adding this. It's just for argument's sake.) Whatever
you're writing with, you need to have the same rules in your head as
the compiler/interpreter uses; beyond that there's a huge amount of
personal preference (I quite like braces, myself, but many others
don't) and only a relatively small amount of actual logic (use ASCII
mathematical symbols to represent mathematical operations).


More information about the Python-list mailing list