# HG changeset patch # User Paul Boddie # Date 1560287685 -7200 # Node ID 5c6b1b19c6f6c9ceee49d728a0027d1b0496289a # Parent 018b653418f2435efb75fca2b284e079723fd881 Added an inline commentary of the "for" loop construct. diff -r 018b653418f2 -r 5c6b1b19c6f6 common.py --- a/common.py Sat Jun 08 17:55:32 2019 +0200 +++ b/common.py Tue Jun 11 23:14:45 2019 +0200 @@ -598,24 +598,47 @@ [compiler.ast.AssName(t2, "OP_ASSIGN")], compiler.ast.Getattr(compiler.ast.Name(t1), "next")), + # try: + compiler.ast.TryExcept( + + # while True: + compiler.ast.While( compiler.ast.Name("True"), compiler.ast.Stmt([ + + # try: + compiler.ast.TryExcept( + + # = () + compiler.ast.Assign( [compiler.ast.AssName(t3, "OP_ASSIGN")], compiler.ast.CallFunc( compiler.ast.Name(t2), [])), + + # except StopIteration: + # raise LoopExit + [(compiler.ast.Name("StopIteration"), None, compiler.ast.Raise(compiler.ast.Name("LoopExit")))], None), + + # ... = + compiler.ast.Assign( [n.assign], compiler.ast.Name(t3)), n.body]), None), + + # except LoopExit: + # {n.else_} + # pass + [(compiler.ast.Name("LoopExit"), None, n.else_ or compiler.ast.Pass())], None) ])