示例#1
0
 def build_Expr(ctx, stmt):
     value = stmt.value
     if value.__class__.__name__ == 'Str':
         # If a statement is a string literal expression,
         # then it is a docstring. Just ignore it.
         return None
     else:
         return ExprStmt(build_expr(ctx, value))
示例#2
0
 def build_Print(ctx, stmt):
     r = ctx.make_range(stmt.lineno, stmt.col_offset,
                        stmt.col_offset + len("print"))
     if stmt.dest:
         raise NotSupportedError(
             r,
             "print statements with non-default destinations aren't supported"
         )
     args = [build_expr(ctx, val) for val in stmt.values]
     return ExprStmt(Apply(Var(Ident(r, "print")), args, []))