Python4Kids New Tutorial: Being Exceptional
May 29, 2012, 15:00 (0 Talkback[s])
(Other stories by Brendan Scott)
How to Help Your Business Become an AI Early Adopter
Apparently, in Python, it is easier to ask for forgiveness rather than seek permission. That is to say, the normal approach when writing Python code is to assume that what you are trying to do will work properly. If something exceptional happens and the code doesn’t work the way you were hoping, then the Python interpreter will tell you of the error so that you can handle that exceptional circumstance. This general approach, of trying to do something, then cleaning up if something goes wrong is acronymically called EAFP (easier to ask for forgiveness than permission). Here is a (somewhat silly) example...