On this page
  1. ast.AsyncWith
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

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

REPL Inspect

from ast import AsyncWith
help(AsyncWith)

Linked from

Related notes