API reference
python:astx:astx.CollectionIndex
class CollectionIndex
CollectionIndex(base: astx.AST, value: astx.AST)
Source: packages/astx/src/astx/collections/common.py:147
Declared as: python:astx:astx.collections.common.CollectionIndex
Common sequence index query node.
Return the first zero-based index of a value in a list or tuple. The initial ASTx contract returns -1 when the value is not found.
Attributes
-
base — Base value or declaration.; Type: astx.AST
-
value — Stored value.; Type: astx.AST
-
type_ — Type associated with this expression.; Type: astx.Int32
-
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 one sequence index query.
-
get_struct — Return the structured representation.