Skip to content

View

MutableSequenceView dataclass

MutableSequenceView(node: NodeType, field: FieldType)

Bases: SequenceView[FieldType, NodeType, ElemType]

popfirst

popfirst() -> ElemType | None

Pop the first element from the view.

Returns:

Type Description
ElemType | None

The first element in the view.

Source code in src/kirin/ir/nodes/view.py
134
135
136
137
138
139
140
141
142
def popfirst(self) -> ElemType | None:
    """Pop the first element from the view.

    Returns:
        The first element in the view.
    """
    if self:
        return self.pop(0)
    return None

poplast

poplast() -> ElemType | None

Pop the last element from the view.

Returns:

Type Description
ElemType | None

The last element in the view.

Source code in src/kirin/ir/nodes/view.py
124
125
126
127
128
129
130
131
132
def poplast(self) -> ElemType | None:
    """Pop the last element from the view.

    Returns:
        The last element in the view.
    """
    if self:
        return self.pop(-1)
    return None