Exception as the primary error handling mechanism?

Steve Holden steve at holdenweb.com
Wed Jan 6 10:21:34 EST 2010


Phlip wrote:
[...]
> Don't prevent me from using a technique just because others had
> trouble with it.
> 
I presume you also campaign against anti-lock braking systems (or at
least don't use cars which have them - after all, anyone who knows how
to drive should be able to brake properly, right? And even if they
don't, *you* can, so you shouldn't have to pay the extra. Of course, if
someone else happens to hit you because they *couldn't* drive safely you
will happily give up your life).

> And if bar() == foo is the superior technique anyway, because the ==
> happens in chronological and lexical order after the bar() call.

That's about the most specious piece of hogwash I've seen this week.
Python doesn't make any guarantees about the evaluation order of =='s
operands (unlike "and" and "or"). That's cargo cult programming right
there. Readability is surely the only reason to decide how to write that
"if", and I suspect most people would choose "if foo == bar()" for that
reason, though the difference is slight.

regards
 Steve
-- 
Steve Holden           +1 571 484 6266   +1 800 494 3119
PyCon is coming! Atlanta, Feb 2010  http://us.pycon.org/
Holden Web LLC                 http://www.holdenweb.com/
UPCOMING EVENTS:        http://holdenweb.eventbrite.com/




More information about the Python-list mailing list