On this page
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
- Separate node from
ast.FunctionDef: Implement bothvisit_FunctionDefandvisit_AsyncFunctionDefinNodeVisitorsubclasses.
REPL Inspect
from ast import AsyncFunctionDef
help(AsyncFunctionDef)
Linked from
Related notes
- tuts/python3/stdlib_module/ast/AsyncFor Linked here; links to this page; shared tags: #ast, #stdlib
- tuts/python3/stdlib_module/ast/AsyncWith 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