On this page
ast.AsyncFor
Prev: ast.AST | Up: ast | Next: ast.AsyncFunctionDef
Rel: ast.Add, ast.alias, ast.And, ast.AnnAssign
Ref: docs.python.org — ast.AsyncFor
Tags: #public #python3 #stdlib #ast
Import
import ast
from ast import AsyncFor
Signature & Overview
ast.AsyncFor(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)
AsyncFor(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)
Usage
import ast
fn = ast.parse("async def f(xs):\n async for x in xs: pass").body[0]
assert isinstance(fn.body[0], ast.AsyncFor)
Gotchas
- Same fields as
ast.For(target,iter,body,orelse): Handle bothast.Forandast.AsyncForin visitors.
REPL Inspect
from ast import AsyncFor
help(AsyncFor)
Linked from
Related notes
- tuts/python3/stdlib_module/ast/AST Linked here; links to this page; shared tags: #ast, #stdlib
- tuts/python3/stdlib_module/ast/AsyncFunctionDef Linked here; links to this page; shared tags: #ast, #stdlib
- tuts/python3/stdlib_module/ast/Add Linked here; shared tags: #ast, #stdlib
- tuts/python3/stdlib_module/ast/alias Linked here; shared tags: #ast, #stdlib
- tuts/python3/stdlib_module/ast/And Linked here; shared tags: #ast, #stdlib
- tuts/python3/stdlib_module/ast/AnnAssign Linked here; shared tags: #ast, #stdlib
- tuts/python3/stdlib_module/ast links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/ast/arg shared tags: #ast, #stdlib
- tuts/python3/stdlib_module/ast/arguments shared tags: #ast, #stdlib
- tuts/python3/stdlib_module/ast/Assert shared tags: #ast, #stdlib