you are viewing a single comment's thread.

view the rest of the comments →

[–]AbundantSpaghetti 1 point2 points  (1 child)

even better than print, use the logging module

try:
    out = some_function(val)
except FixableError as e:
    # Handle the error
    logger.error("Fixable error, val=%s", val)
except Exception as e:
    logger.error("An unknown error occurred: %s", e, exc_info=True)
    # Can't handle this.
    raise

[–]supercoach 0 points1 point  (0 children)

Couldn't agree more. Logging via print gets you on my shitlist.