def f(): try: print('something') except Exception as e: # ... Code that does not use 'e' print('something else')