Assign#

class astroid.nodes.Assign(lineno: int | None, col_offset: int | None, parent: NodeNG | None, *, end_lineno: int | None, end_col_offset: int | None)[source]#

Bases: AssignTypeNode, Statement

Class representing an ast.Assign node.

An Assign is a statement where something is explicitly asssigned to.

>>> import astroid
>>> node = astroid.extract_node('variable = range(10)')
>>> node
<Assign l.1 at 0x7effe1db8550>
assigned_stmts(**kwargs: _P.kwargs) Generator[InferenceResult, None, None]#

Returns the assigned statement (non inferred) according to the assignment type. See astroid/protocols.py for actual implementation.

get_children()[source]#

Get the child nodes below this node.

postinit(targets: list[NodeNG], value: NodeNG, type_annotation: NodeNG | None) None[source]#
targets: list[NodeNG]#

What is being assigned to.

type_annotation: NodeNG | None#

If present, this will contain the type annotation passed by a type comment

value: NodeNG#

The value being assigned to the variables.