Ignoring Exceptions
Sometimes you don't care if some operation fails.
To ignore some exception, you usually do something like this:
some_list = [0, 1, 2, 3, 4]
try:
print(some_list[42])
except IndexError:
pass
That will work (without printing anything), but there is another way to do the same more expressively and explicitly:
from contextlib import suppress
some_list = [0, 1, 2, 3, 4]
with suppress(IndexError):
print(some_list[42])