.. index:: py::builtins::list::extend .. _doxycast_pypp_classpy_1_1builtins_1_1list_1a060018bcb62b4e248f629332466d4999: .. _py-builtins-list-extend: *py::builtins::list::*\ extend ============================== .. code-block:: cpp template void extend(const iterable_type& iterable); Appends all element of given iterable to the list. .. tip:: Same as:: this->insert(-1, iterable.begin(), iterable.end()); Template parameters ------------------- ``iterable_type``: The type of iterable object. Parameters ---------- ``iterable``: An iterable object. Complexity ---------- Linear in the size of iterable plus linear in the size of the list if causes reallocation, linear in the size of iterable otherwise. Example ------- .. code-block:: cpp #include #include int main() { py::list list = {0, 1}; py::print(list); list.extend(py::list(2, 3)); py::print(list); } **Output**: .. code-block:: text {0, 1} {0, 1, 2, 3}