Issue #14044 has been updated by Eregon (Benoit Daloze).


That's a big breaking change, and Range then needs to know about something like a "step value" which makes it more complex.
Why not introducing your own StepRange or so in PyCall then?

BTW, I think #13904 is more reasonable,
and only makes information that is always needed anyway and already can be observed though Enumerator#inspect available for other uses.
e.g. if someone wants to pretty-print an Enumerator differently than #inspect, they should be able to get the receiver, method and arguments, no point to hide that, it's already user-visible in #inspect.

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

* Author: mrkn (Kenta Murata)
* Status: Open
* Priority: Normal
* Assignee: 
* 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>