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

ast.AsyncFunctionDef

Prev: ast.AsyncFor | Up: ast | Next: ast.AsyncWith
Rel: ast.Add, ast.alias, ast.And, ast.AnnAssign
Ref: docs.python.org — ast.AsyncFunctionDef
Tags: #public #python3 #stdlib #ast


Import

import ast
from ast import AsyncFunctionDef

Signature & Overview

ast.AsyncFunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list, expr? returns, string? type_comment, type_param* type_params)

AsyncFunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list, expr? returns, string? type_comment, type_param* type_params)

Usage

import ast

fn = ast.parse("async def fetch(): return 1").body[0]
assert isinstance(fn, ast.AsyncFunctionDef) and fn.name == "fetch"

Gotchas

REPL Inspect

from ast import AsyncFunctionDef
help(AsyncFunctionDef)

Linked from

Related notes