Comparison with False - something I don't understand

Steve Holden steve at holdenweb.com
Sat Dec 4 11:40:54 EST 2010


On 12/2/2010 11:42 PM, Harishankar wrote:
> One of the reasons why I feared to do this is because I need to know each 
> and every exception that might be thrown by the function and litter my 
> top-level code with too many exception handlers.
> 
You appear to be suffering from the delusion that all exceptions must be
caught and handled. This is far from being the case. But still, better
to have your top-level code "littered with exception handlers" than to
have your functions "littered with if statements".

Quite often it's impossible for the function to know what needs to be
done when a specific conditions arises, in which case (presumably) you
have to return some error code and test for that ...

regards
 Steve
-- 
Steve Holden           +1 571 484 6266   +1 800 494 3119
PyCon 2011 Atlanta March 9-17       http://us.pycon.org/
See Python Video!       http://python.mirocommunity.org/
Holden Web LLC                 http://www.holdenweb.com/




More information about the Python-list mailing list