I'd just like to exit out of a
with open(path) as f:
print 'before condition'
if <condition>: break #syntax error!
print 'after condition'
if not <condition>: print 'after condition'
The best way would be to encapsulate it in a function and use
def do_it(): with open(path) as f: print 'before condition' if <condition>: return print 'after condition'