array slicing currently does not support steps?

mw mingwu at
Mon Aug 3 23:32:29 UTC 2020


I just noted that D array slice does not support steps?

Ever since Python 1.4, the slicing syntax has supported an 
optional third ``step'' or ``stride'' argument. For example, 
these are all legal Python syntax: L[1:10:2], L[:-1:1], L[::-1]. 
This was added to Python at the request of the developers of 
Numerical Python, which uses the third argument extensively.

>>> L = range(10)
>>> L[::2]
[0, 2, 4, 6, 8]

Shall we add a DIP for this?

More information about the Digitalmars-d mailing list