Comparison with False - something I don't understand

Terry Reedy tjreedy at udel.edu
Thu Dec 2 13:31:30 EST 2010


On 12/2/2010 9:56 AM, Harishankar wrote:

> There are some reasons why I hate exceptions but that is a different
> topic. However, in short I can say that personally:
>
> 1. I hate try blocks which add complexity to the code when none is
> needed. Try blocks make code much more unreadable in my view and I use it
> only for the built-in exceptions when absolutely needed.
>
> 2. I prefer the less irksome True or False to do error checking.
> Exceptions seem too heavyweight for simple problems.

It turns out that try block are computationally lighter weight (faster) 
for normal execution ;-)

> 3. Philosophically I think exception handling is the wrong approach to
> error management. I have never grown up programming with exceptions in C
> and I couldn't pick up the habit with python either. Did I mention that I
> detest try blocks? try blocks seem ugly and destroy code clarity at least
> in my view. And enclosing single statements under separate try blocks
> seem to add a lot of clutter.

Having also come to Python directly from C, I can sympathize. It took me 
a while to adjust.

-- 
Terry Jan Reedy




More information about the Python-list mailing list