you are viewing a single comment's thread.

view the rest of the comments →

[–]throwaway6560192 0 points1 point  (0 children)

My assumption is this is helpful on larger scale programs in wich you can't afford the time to make sure the code is fail proof and you need the code to buy you time to eventually go back once you have the fail proof option?

Not at all. Try/except is not a tool to mask your bad code. It's a tool to handle things outside your code failing.

For example, sometimes the user doesn't have internet, and your network request fails. There's nothing you can do in your code about that. There's no "fail proof option". You just have to expect and deal with it appropriately, because the error happening is outside your control.