<p dir="ltr">Although slices and ranges are used for different things and implemented differently, conceptually they are similar: they define an integer sequence with a start, stop, and step size. For this reason I think that slices could provide useful syntactic sugar for defining ranges without sacrificing clarity.</p>
<p dir="ltr">The syntax I propose is simply to wrap a slice in parentheses. For examples, the following pairs are equivalent:</p>
<p dir="ltr">range(4, 10, 2)<br>
(4:10:2)</p>
<p dir="ltr">range(3, 7)<br>
(3:7)</p>
<p dir="ltr">range(5)<br>
(:5)</p>
<p dir="ltr">This syntax should not be easily confused with any existing syntax. Slices of sequences use square brackets, dictionaries use curly braces, and function annotations only appear in function declarations. It is also considerably more compact than the current range syntax, while still being similar to a syntax (slicing) all python users should be familiar with.</p>