.. index:: py::builtins::list::clear .. _doxycast_pypp_classpy_1_1builtins_1_1list_1a52b1f4d12d0c43ebdab7626c8ea7eb4f: .. _py-builtins-list-clear: *py::builtins::list::*\ clear ============================= .. code-block:: cpp void clear(); Clears the list. Complexity ---------- Linear in the size of the list. Example ------- .. code-block:: cpp #include #include int main() { py::list list = {0, 1}; py::print(list); list.clear(); py::print(list); } **Output**: .. code-block:: text {0, 1} {}