Skip to content

Instantly share code, notes, and snippets.

@tomleo
Last active December 13, 2015 18:49
Show Gist options
  • Save tomleo/4958325 to your computer and use it in GitHub Desktop.
Save tomleo/4958325 to your computer and use it in GitHub Desktop.
A better UX for python tracebacks (The tracebacks) http://tomleos.tumblr.com/post/43123575189/a-better-ux-for-python-tracebacks
In [12]: calculate(4,0)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
/home/tom/<ipython-input-12-4fcddf188333> in <module>()
----> 1 calculate(4,0)
/home/tom/<ipython-input-10-ea74cc892d2c> in calculate(a, b)
6 result = divide(a, b)
7 except:
----> 8 raise Exception('You Done Goofed')
9 return result
Exception: You Done Goofed
In [14]: calculate(4,0)
---------------------------------------------------------------------------
ZeroDivisionError Traceback (most recent call last)
/home/tom/<ipython-input-14-4fcddf188333> in <module>()
----> 1 calculate(4,0)
/home/tom/<ipython-input-13-682ab59c8200> in calculate(a, b)
4 def calculate(a, b):
5 try:
----> 6 result = divide(a, b)
7 except:
8 raise
/home/tom/<ipython-input-13-682ab59c8200> in divide(a, b)
1 def divide(a, b):
----> 2 return a/b
3
4 def calculate(a, b):
5 try:
ZeroDivisionError: integer division or modulo by zero
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment