Python - try else Clause

Introduction

You can use else clause to set Boolean flags indicating if an exception had ever happended.

Consider the following code with out else statement

try: 
    ...run code... 
except IndexError: 
    ...handle exception... 
# Did we get here because the try failed or not? 

The else clause provides syntax in a try that makes what has happened obvious and unambiguous:

try: 
    ...run code... 
except IndexError: 
    ...handle exception... 
else: 
    ...no exception occurred...