On this page
ast.AsyncWith
Prev: ast.AsyncFunctionDef | Up: ast | Next: ast.Attribute
Rel: ast.Add, ast.alias, ast.And, ast.AnnAssign
Ref: docs.python.org — ast.AsyncWith
Tags: #public #python3 #stdlib #ast
Import
import ast
from ast import AsyncWith
Signature & Overview
ast.AsyncWith(withitem* items, stmt* body, string? type_comment)
AsyncWith(withitem* items, stmt* body, string? type_comment)
Usage
import ast
fn = ast.parse("async def f(cm):\n async with cm: pass").body[0]
assert isinstance(fn.body[0], ast.AsyncWith)
Gotchas
- Same structure as
ast.With: Contains a list ofast.withitemobjects in.items.
REPL Inspect
from ast import AsyncWith
help(AsyncWith)
Linked from
Related notes
- tuts/python3/stdlib_module/ast/AsyncFunctionDef Linked here; links to this page; shared tags: #ast, #stdlib
- tuts/python3/stdlib_module/ast/Attribute 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/AST 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