.. index:: py::builtins::list::operator = .. _doxycast_pypp_classpy_1_1builtins_1_1list_1abc031d4f0e2215bec0d2970cd697cfdc: .. _py-builtins-list-operator-assign: *py::builtins::list::*\ operator = ================================== .. code-block:: cpp list& operator = (const list& other); Assigns another list or slice to the list. Parameters ---------- ``other``: Another list or slice. Return value ------------ ``*this``. Complexity ---------- Linear in the size of ``other``. Example ------- .. code-block:: cpp #include #include int main() { py::list list{0, 9, 1, 3}; list = {5} py::print(list); } **Output**: .. code-block:: text {5}