Nick Coghlan did a +1 job to write: > 1. Amend the statement specification such that: > > with EXPR as VAR: > BLOCK > > is translated as: > > abc = (EXPR).__with__() > exc = (None, None, None) > VAR = abc.__enter__() > try: > try: > BLOCK > except: > exc = sys.exc_info() > raise > finally: > abc.__exit__(*exc)
Note that __with__ and __enter__ could be combined into one with no loss of functionality: abc,VAR = (EXPR).__with__() exc = (None, None, None) try: try: BLOCK except: exc = sys.exc_info() raise finally: abc.__exit__(*exc) - Anders _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com