Skip to main content

PySequenceIterable

This class provides a unified interface for iterating over various Python sequence and collection types, including lists, tuples, sets, and iterators. It acts as a wrapper that abstracts the specific underlying container type to facilitate generic sequence processing. This allows for consistent iteration behavior across different Python data structures within a Rust context.

Attributes

AttributeTypeDescription
ListBound< 'py, PyList >A reference to a Python list object used for sequence iteration.
TupleBound< 'py, PyTuple >A reference to a Python tuple object used for sequence iteration.
SetBound< 'py, PySet >A reference to a Python set object used for sequence iteration.
FrozenSetBound< 'py, PyFrozenSet >A reference to a Python frozenset object used for sequence iteration.
IteratorBound< 'py, PyIterator >An owned Python iterator object used for sequence iteration.

Constructor

Signature

def List(
list_ref: Bound< 'py, PyList >
) - > [PySequenceIterable](pysequenceiterable.md?sid=input_input_python_pysequenceiterable)

Parameters

NameTypeDescription
list_refBound< 'py, PyList >The bound reference to the Python list to be iterated over.

Signature

def Tuple(
tuple_ref: Bound< 'py, PyTuple >
) - > [PySequenceIterable](pysequenceiterable.md?sid=input_input_python_pysequenceiterable)

Parameters

NameTypeDescription
tuple_refBound< 'py, PyTuple >The bound reference to the Python tuple to be iterated over.

Signature

def Set(
set_ref: Bound< 'py, PySet >
) - > [PySequenceIterable](pysequenceiterable.md?sid=input_input_python_pysequenceiterable)

Parameters

NameTypeDescription
set_refBound< 'py, PySet >The bound reference to the Python set to be iterated over.

Signature

def FrozenSet(
frozenset_ref: Bound< 'py, PyFrozenSet >
) - > [PySequenceIterable](pysequenceiterable.md?sid=input_input_python_pysequenceiterable)

Parameters

NameTypeDescription
frozenset_refBound< 'py, PyFrozenSet >The bound reference to the Python frozenset to be iterated over.

Signature

def Iterator(
iterator_obj: Bound< 'py, PyIterator >
) - > [PySequenceIterable](pysequenceiterable.md?sid=input_input_python_pysequenceiterable)

Parameters

NameTypeDescription
iterator_objBound< 'py, PyIterator >The bound Python iterator object used to yield sequence elements.