Multi-argument append() is illegal

Thomas Wouters thomas at xs4all.net
Sun Mar 26 01:40:25 CET 2000


On Wed, Mar 01, 2000 at 01:27:31AM -0800, Ken Seehof wrote:
> I agree.  I heard a story about a flaw in makefile syntax.  The flaw survives to
> today because the guy who invented "make" said, "Well, we can't change it now
> cause there are 15 people using it".

The same goes for the precedence of the & and | operator in C.
'a & b == 1' is interpreted as 'a & (b == c)', making for occasionally hard
to find bugs. Never stepped into this one myself, thankfully, mostly because
someone else taught me the habit of keeping bitwise operators (mostly used
for flags anyway) inside macros, and always enclose those in life-safers
(aka '()').

Quoting Dennis Ritchie's posting in net.lang.c, October 22nd, 1982,
"Operator precendence":

"""
The priorities of && || vs. == etc. came about in the following way. Early C
had no separate operators for & and && or | and ||. (Got that?) Instead it
used the notion (inherited from B and BCPL) of "truth-value context": where
a Boolean value was expected, after "if" and "while" and so forth, the & and
| operators were interpreted as && and || are now; in ordinary expressions,
the bitwise interpretations were used. It worked out pretty well, but was
hard to explain. (There was the notion of "top-level operators" in a
truth-value context.)

The precedence of & and | were as they are now. Primarily at the urging of
Alan Snyder, the && and || operators were added. This successfully separated
the concepts of bitwise operations and short-circuit Boolean evaluation.
However, I had cold feet about the precedence problems. For example, there
were lots of programs with things like if (a==b & c==d) ...

In retrospect it would have been better to go ahead and change the
precedence of & to higher than ==, but it seemed safer just to split & and
&& without moving & past an existing operator. (After all, we had several
hundred kilobytes of source code, and maybe 3 installations...)
"""

Now it all becomes clear to me... Dennis has as much hindsight as Guido
(20/20, that is) but Guido has the timemachine. But it wouldn't do to erase
this mistake completely, after all, many people can learn from them ;)
Personally, I'm very glad Guido takes the time to fix those 'several hundred
kilobytes of source code.' ;)

For the record, I dont think i was into programming yet, in 1982... I think
I was mostly into reading my first few kindergarten books ;)

books-rule'ly y'rs.

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list