There is a collection of nodes used to represent assignments. Each
assignment statement in the source code becomes a single
Assign node in the AST. The nodes attribute is a
list that contains a node for each assignment target. This is
necessary because assignment can be chained, e.g. a = b = 2
.
Each Node in the list will be one of the following classes:
AssAttr, AssList, AssName, or
AssTuple.
Each target assignment node will describe the kind of object being
assigned to: AssName for a simple name, e.g. a = 1
.
AssAttr for an attribute assigned, e.g. a.x = 1
.
AssList and AssTuple for list and tuple expansion
respectively, e.g. a, b, c = a_tuple
.
The target assignment nodes also have a flags attribute that indicates whether the node is being used for assignment or in a delete statement. The AssName is also used to represent a delete statement, e.g. del x.
When an expression contains several attribute references, an assignment or delete statement will contain only one AssAttr node - for the final attribute reference. The other attribute references will be represented as Getattr nodes in the expr attribute of the AssAttr instance.
See About this document... for information on suggesting changes.