
On Mon, Feb 2, 2015 at 11:03 AM, Nick Coghlan ncoghlan@gmail.com wrote:
On 2 Feb 2015 01:14, "Todd" toddrjen@gmail.com wrote:
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.
Why is this beneficial? We'd be replacing an easily looked up builtin name with relatively cryptic syntax.
First, it wouldn't be a replacement. The existing range syntax would still exist.
But the reason it is beneficial is the same reason we have [a, b, c] for list, {a:1, b:2, c:3} for dicts, {a, b, c} for sets, and (a, b, c) for tuples. It is more compact way to create a commonly-used data structure.
And I wouldn't consider it any more cryptic than any other literal we have.