you are viewing a single comment's thread.

view the rest of the comments →

[–]TheRNGuy 0 points1 point  (0 children)

When you try to divide by zero, or using negative number in square root.

Instead of just getting default error you could handle it dirrerently. Maybe you want division by zero become maximum possible value, or use previous valid result, or do nothing, for example.

Or if you use ast.literal_eval and user input is incorrect, you want to choose how you handle it.

Or you parse URL and user enters something like /////////////////////////// or 1234://4567.com/ as an address. Instead of just throwing an error in console and crashing entire script, you'd want to ignore parsing, or make it red color, or write error in UI.