Is there any pattern that allows you to exit from a Context Manager and return the control flow to the code following the with (...):
?
For example (doesn't actually work):
with open('/etc/passwd', 'r') as f:
f.seek(0, 2)
if f.tell() < 10:
print "The file is too small!"
break
# Process the file.
Is there anything I can replace break
with to do the same thing?