self.manager.analyse_types(env)
self.body.analyse_expressions(env)
+ def generate_function_definitions(self, env, code):
+ self.manager.generate_function_definitions(env, code)
+ self.body.generate_function_definitions(env, code)
+
def generate_execution_code(self, code):
code.putln("/*with:*/ {")
self.manager.generate_evaluation_code(code)
except:
print("outer except")
+def functions_in_with():
+ """
+ >>> f = functions_in_with()
+ enter
+ exit <type 'type'> <type 'MyException'> <type 'traceback'>
+ outer except
+ >>> f(1)[0]
+ 1
+ >>> print(f(1)[1])
+ value
+ """
+ try:
+ with ContextManager("value") as value:
+ def f(x): return x, value
+ make = lambda x:x()
+ raise make(MyException)
+ except:
+ print("outer except")
+ return f
+
def multitarget():
"""
>>> multitarget()