t483.trans 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. Module(body=[FunctionDef(name='divide',
  2. args=arguments(args=[Name(id='x',
  3. ctx=Param()),
  4. Name(id='y',
  5. ctx=Param())],
  6. vararg=None,
  7. kwarg=None,
  8. defaults=[]),
  9. body=[TryExcept(body=[Assign(targets=[Name(id='result',
  10. ctx=Store())],
  11. value=BinOp(left=Name(id='x',
  12. ctx=Load()),
  13. op=Div(),
  14. right=Name(id='y',
  15. ctx=Load())))],
  16. handlers=[ExceptHandler(type=Name(id='ZeroDivisionError',
  17. ctx=Load()),
  18. name=None,
  19. body=[Print(dest=None,
  20. values=[Str(s='division by zero!')],
  21. nl=True)])],
  22. orelse=[Print(dest=None,
  23. values=[Str(s='result is'),
  24. Name(id='result',
  25. ctx=Load())],
  26. nl=True)])],
  27. decorator_list=[]),
  28. Expr(value=Call(func=Name(id='divide',
  29. ctx=Load()),
  30. args=[Num(n=2),
  31. Num(n=1)],
  32. keywords=[],
  33. starargs=None,
  34. kwargs=None)),
  35. Expr(value=Call(func=Name(id='divide',
  36. ctx=Load()),
  37. args=[Num(n=2),
  38. Num(n=0)],
  39. keywords=[],
  40. starargs=None,
  41. kwargs=None)),
  42. TryExcept(body=[Expr(value=Call(func=Name(id='divide',
  43. ctx=Load()),
  44. args=[Str(s='2'),
  45. Str(s='1')],
  46. keywords=[],
  47. starargs=None,
  48. kwargs=None))],
  49. handlers=[ExceptHandler(type=Name(id='TypeError',
  50. ctx=Load()),
  51. name=Name(id='e',
  52. ctx=Store()),
  53. body=[Print(dest=None,
  54. values=[Name(id='e',
  55. ctx=Load())],
  56. nl=True)])],
  57. orelse=[])])