if <assignment>:

David Brown david at no.westcontrol.spam.com
Tue Nov 26 05:41:24 EST 2002


<maney at pobox.com> wrote in message news:artvr3$cbe$2 at wheel2.two14.net...
> David Brown <david at no.westcontrol.spam.com> wrote:
> > correctness.  This particular "feature" is a huge source of bugs and
> > frustration in C programming - mixing up "=" and "==" in conditions is
> > probably the biggest single cause of C program bugs.  Python, on the
other
>
> Are you speaking from experience, or is this as well-founded as the
> hysterical wails about how Python's use of indentation is just wrong?
> It certainly isn't remotely near my own experience (which covers a bit
> more than two decades, during much of which C was used more than
> anything else).

It is certainly a mistake I have made.  C has a number of these "features",
where you can very easily write valid C code that looks and reads like it
should work ("=" and "==" look and read the same at first glance), yet
fails.  The one that gets me more often is missing a "break" in a switch
statement.  The more you write C, the less you make these sort of mistakes,
so they are of a much bigger problem to newbies.  But if you look at any of
the coding standards designed for writing safety-critical or highly reliable
code, they are full of rules about writing unnatural things like "if (1 ==
x)" or "if ((y) == x)" to force C compilers to generate error messages when
you make these mistakes.






More information about the Python-list mailing list