Proposal to Add an Optional Inclusive Parameter to Python’s range() Function

I am considering proposing an optional parameter, inclusive, for the built-in range() function and would appreciate feedback before drafting a formal PEP.

The idea is to extend the existing function signature without introducing new syntax or a separate function. When inclusive=True, the stop value would be included in the generated sequence. By default, this parameter would be set to False, ensuring that the current behavior of range() remains unchanged.

This approach aims to provide greater flexibility while preserving backward compatibility.

Last similar thread: