Steven D'Aprano wrote:
except SyntaxError: def inner(): # manually operate the context manager call context manager __enter__ try: try: return something except: # Yes, a bare except. Catch EVERYTHING. blah blah blah finally: call context manager __exit__
Why not just use this version all the time? It should work in both 2.x and 3.x. -- Greg -- https://mail.python.org/mailman/listinfo/python-list