.. index:: py::builtins::list::list .. _doxycast_pypp_classpy_1_1builtins_1_1list_1a0381cce6c80ea8efc953f3a658158951: .. _py-builtins-list-list: *py::builtins::list::*\ list ============================ .. code-block:: cpp list(); // 1 template explicit list(const array_t& array); // 2 list(const std::initializer_list& array); // 3 list(const list& other); // 4 list(list&& other); // 5 1. Constructs an empty list. 2. Constructs a list from another iterable object. 3. Constructs a list from a initializer list. 4. Copy constructs a list. 5. Move constructs a list. Template parameters ------------------- ``array_t``: The type of another iterable object. Parameters ---------- ``array``: (2): another iterable object, (3): an initializer list. ``other``: Another ``py::builtins::list`` object. Complexity ---------- 1. Constant. 2. Linear in the size of ``array``. 3. Same as (2). 4. Linear in the size of ``other``. 5. Constant. Example ------- .. code-block:: cpp #include #include int main() { // Default constructor py::list list; py::print(list); // No output... py::list list2 = {0, 1, 2, 3, 4, 5, 6}; py::print(list2); } **Output**: .. code-block:: text {} {0, 1, 2, 3, 4, 5, 6}