Exception as the primary error handling mechanism?

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Fri Jan 1 09:24:50 EST 2010


On Fri, 01 Jan 2010 02:43:21 -0800, Jonathan Gardner wrote:

> On Jan 1, 12:43 am, a... at pythoncraft.com (Aahz) wrote:
>> In article <mailman.300.1262323578.28905.python-l... at python.org>,
>> Benjamin Kaplan  <benjamin.kap... at case.edu> wrote:
>> >In Python, throwing exceptions for expected outcomes is considered
>> >very bad form [...]
>>
>> Who says that?  I certainly don't.
> 
> Agreed.
> 
> int("asdf") is supposed to return what, exactly? Any language that tries
> to return an int is horribly broken.


[sarcasm]
No no, the right way to deal with that is have int("asdf") return some 
arbitrary bit pattern, and expect the user to check a global variable to 
see whether the function returned a valid result or not. That's much 
better than catching an exception!
[/sarcasm]


-- 
Steven



More information about the Python-list mailing list