Talk:Python Programming/Exceptions

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search

There is no way exceptions should be used for GOTO style programming EVER ... That just smacks of increadiblly bad design ... —The preceding unsigned comment was added by 213.86.142.250 (talkcontribs) 10:05, 26 August 2005.

I agree, but the example in the module isn't abusing exceptions as a GOTO statement :-) Thunderbolt16 19:47, 18 September 2005 (UTC)

Another vote for not using exceptions as GOTO statements. They are called exceptions for a reason. You should use if statements and check them correctly instead of arbitrarily running stuff. I haven't looked at how exceptions are actually handled in the python code but they are probably expensive as in other languages. —The preceding unsigned comment was added by 71.4.57.161 (talkcontribs) 23:37, 23 June 2006.

Maybe someone could offer wisdom on how much to use exceptions in Python? In C++/Java they are generally used "in exceptional circumstances" and are quite expensive. Does their design in Python lead to more generous use such as filtering inputs in functions rather than returning a default or known error value? —The preceding unsigned comment was added by 86.136.239.234 (talkcontribs) 16:48, 8 October 2005.

Actually, this style of programming is encouraged in Python, it's called "EAFP". I've removed the "dubious" tag. --193.11.177.69 (talk) 22:41, 29 August 2009 (UTC)