Silly newbie question - Caret character (^)

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Tue Nov 9 17:32:32 EST 2010


In message <mailman.778.1289325458.2218.python-list at python.org>, Terry Reedy 
wrote:

> I've been wondering why C programmers keep writing code susceptible to
> buffer overruns ;=).

I am continually disappointed with the ‘do as I say, not as I do” attitude 
among people offering up sample code. I remember writing to one contributor 
to a programming magazine many years ago, about his admonition not to simply 
copy-and-paste sample code, to point out that he had done exactly that 
(complete with bug).

The main sticking point seems to be error checking; for some reason, writers 
of sample code seem to believe the code is “clearer” if you leave this out, 
when in fact all real-world applications of the illustrated techniques would 
include the error checks. So what do they end up illustrating? Nothing 
relevant to the real world.

Is this why so many real-world programs fail to check for errors in 
important places, and segfault or behave unpredictably instead of gracefully 
reporting a problem?



More information about the Python-list mailing list