New Science Discovery: Perl Detracters Remain Idiots After A Decade!

Chiron chiron613 at
Wed Feb 29 23:52:27 EST 2012

On Wed, 29 Feb 2012 23:06:42 -0500, Shmuel (Seymour J.) Metz wrote:

> In <ubo3r.20367$kv1.9848 at newsfe03.iad>, on 02/29/2012
>    at 11:43 AM, Chiron <chiron613 at> said:
>>Sure, mathematically it *should* go a particular way,
> No. Mathematically it should go the way that it is defined to go. There
> is nothing in Mathematics that either requires or prohibits infix
> notation in programming languages, or even in Mathematical notation.
Yes.  That (the mathematically defined way) is a particular way, is it 

>>it makes sense to keep things as clear as possible.
> Often infix notation with well thought out precedence is the clearest
> way to go. RPN and the like have their place, but often are difficult
> for real people to read.

However, I wasn't specifically referring to infix/postfix/prefix or 
anything of that nature.  I wasn't limiting my comment to lisp notation 
in particular, since what I said applies to any language.  I was 
referring to the placement of parentheses (or other groupings) to 
indicate to *humans* what the intended sequence of events was.  The 
problem with precedence is that it is not always clear how it will go.  
Different languages have different rules, some of which depart from the 
rules in mathematics.  Some implementations of languages are buggy in 
this regard.

Mathematically, and in any language with which I am familiar, the 
sequence:  2 + 6 / 3 will yield 4.  It is unnecessary, but harmless, to 
write this as 2 + (6 / 3).  A naive reader (or just a tired or hurried 
one) might come up with 8 / 3 if there aren't any parentheses.

Whenever there is *any* possibility of ambiguity, I see no reason not to 
clarify.  Back in the days when the way you wrote your code affected how 
it was compiled, it made sense to rely heavily on language-specific 
features, thus saving a few bytes.  With gigabyte memories, gigahertz 
clock speeds, and optimizing compilers, the pressure to try to optimize 
by hand is gone.  A few extra parentheses, or even breaking down a 
complex sequence of events into discrete, simpler ones, is no longer a 
costly luxury.  A few extra variables, if they help clarity, aren't going 
to hurt anything.  Let the machine do the grunt work.  Pamper your 
readers (which in a few weeks or months might be you) and show exactly 
what you had in mind.  That's all I'm saying.

I'd just as soon kiss a Wookie.
		-- Princess Leia Organa

More information about the Python-list mailing list