Skip to main content

Assignment AST Python Object

The Assignment object matches a Python assignment.

The astType value for this node is assignment.

Code Pattern

This AST element captures the following code.

my_variable = my_value

Attributes

  • astType: constant string value ("assignment")
  • left (any type that inherits AstElement)
  • right (any type that inherits AstElement)
info

To know what is the type of left or right, use the astType to distinguish.

For example, to check if the left node is a string, just use the following code:

if (node.left.astType === "string") {
....
}