Issue #14044 has been updated by mrkn (Kenta Murata).

Status changed from Open to Rejected

I've discussed this issue and #13904 in today's developer meeting.
Following the discussion, I decided to withdraw the proposal of range with step.
Instead I propose to introduce a subclass of Enumerator that provides the attributes of first, last, and step values of range with step.

I will close this issue and reopen #13904 for the new proposal.

Thanks.

----------------------------------------
Feature #14044: Introduce a new attribute `step` in Range
https://bugs.ruby-lang.org/issues/14044#change-70996

* Author: mrkn (Kenta Murata)
* Status: Rejected
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
As described in #13904, Numo::NArray and PyCall touches internal structure of Enumerator to obtain the argument of `Range#step`.
**This information is necessary to realize the same manner of the utilization of Python's slices**.

In this ticket, I propose to introduce the new attribute `step` in an instance of `Range` class.
Its role is same as the `step` attribute of Python's slice.

`Range#step` should be changed to return a new Range object with the given step value instead of an Enumerator.
The default value of `step` attribute is `nil`, and it means that step is 1.





-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>