Friendly was recently brought to our attention and we knew immediately that we wanted to share this with our teachers. Friendly is an external module for Python that elaborates on what has caused an exception to be thrown in your Python program. To illustrate how Friendly works, they’ve handily provided a great example in their documentation. Say I’ve got this code:
-!- CODE language-py -!-# example.py
last_index = len(seq)
print(get_last([1, 2, 3]))
Running this program with vanilla python in CodeGrade, we get this error traceback:
While an experienced python programmer knows immediately where to look in the traceback and understands what an IndexError entails, a novice python programmer may not find this information very helpful if they don’t know how indexing works (or what indexing even is).
With Friendly, the error-traceback looks like this: