.. index:: py::builtins::range::range .. _doxycast_pypp_classpy_1_1builtins_1_1range_1aca90576d0b3b5f2033597b141305adae: .. _py-builtins-range-range: *py::builtins::range::*\ range ============================== .. code-block:: cpp constexpr range(const type& stop); // 1 constexpr range(type&& stop); // 2 constexpr range(const type& start, const type& stop, long step = 1); // 3 constexpr range(type&& start, type&& stop, long step = 1); // 4 1. Constructs an range with given stop. 2. Same as (1). 3. Constructs a range from given start, stop and step. 4. Same as (3). Parameters ---------- ``start``: The start of range. See :ref:`py-builtins-range-stop`. ``stop``: The stop of range (exclusive). See :ref:`py-builtins-range-stop`. ``step``: The step of range. See :ref:`py-builtins-range-stop`. Complexity ---------- Constant. Example ------- .. code-block:: cpp #include #include #include int main() { py::range range(7); py::print(py::list(range)); } **Output**: .. code-block:: text {0, 1, 2, 3, 4, 5, 6}