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

ast.Assign

Prev: ast.Assert | Up: ast | Next: ast.AST
Rel: ast.Add, ast.alias, ast.And, ast.AnnAssign
Ref: docs.python.org — ast.Assign
Tags: #public #python3 #stdlib #ast


Import

import ast
from ast import Assign

Signature & Overview

ast.Assign(expr* targets, expr value, string? type_comment)

Assign(expr* targets, expr value, string? type_comment)

Usage

import ast

stmt = ast.parse("a = b = 1").body[0]
assert isinstance(stmt, ast.Assign) and len(stmt.targets) == 2

Gotchas

REPL Inspect

from ast import Assign
help(Assign)

Linked from

Related notes