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

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

REPL Inspect

from ast import AsyncFor
help(AsyncFor)

Linked from

Related notes