API reference
python:astx:astx.collections.list.ListExpr
class ListExpr
ListExpr(elements: Sequence[astx.Expr], loc: SourceLocation = NO_SOURCE_LOCATION)
Source: packages/astx/src/astx/collections/list.py:22
Ordered expression-valued collection construction.
Evaluate elements once, left to right. Semantic analysis chooses the concrete list element type, or a tensor under an explicit tensor target. Unlike LiteralList, elements need not be literals.
Attributes
-
elements — Elements.; Type: list[astx.Expr]
-
type_ — Type associated with this expression.; Type: AnyType
-
loc — Type: SourceLocation
-
kind — Type: ASTKind
-
comment — Type: str
-
parent — Type: Optional[ASTNodes]
-
ref — Type: str
-
nbytes — Type: int
-
name — Type: str
-
_tmp_id — Type: int
Methods
-
__init__ — Initialize a collection expression without inferring its type.
-
get_struct — Preserve each element in the structured representation.