Lev
Lev

Reputation: 1930

python `traceback` production performance

I'm using try catch blocks to handle exceptions in my Django app. However, I'm also using traceback module to print debug information in case an exception is caught.

try:
   # Exception gets thrown here
except:
   traceback.print_exc()

Should I remove this when moving into production? Does this have significant performance consequences (like xdebug in PHP, for instance)?

Upvotes: 0

Views: 617

Answers (1)

Martijn Pieters
Martijn Pieters

Reputation: 1121834

No, there are no significant performance implications to this; the traceback is already present with the exception when it is raised.

All traceback.print_exc() does is print the information already there.

Upvotes: 1

Related Questions