Comparison with False - something I don't understand

Harishankar v.harishankar at gmail.com
Thu Dec 2 09:56:29 EST 2010


On Thu, 02 Dec 2010 08:44:11 -0600, Tim Chase wrote:

> On 12/02/2010 08:18 AM, Harishankar wrote:
>> Here I'm using it to compare the result of a function where I
>> specifically return False on error condition,
> 
> This sounds exactly like the reason to use exceptions...you have an
> exceptional error condition.
> 
> -tkc

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.

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. 

-- 
Harishankar (http://harishankar.org http://lawstudentscommunity.com)




More information about the Python-list mailing list