bpo-33998: randrange silently ignoring alt steps by mr-nfamous · Pull Request #8010 · python/cpython
randrange currently and probably has always done nothing when provided with a non-default step value. There are two solutions: make the non-default step value actually have an effect on the potential results; or, cause it to throw an exception warning users that changing the value of step is pointless without providing an explicity stopping point. While the first solution conflicts with the behavior of range, that isn't necessarily a bad thing. Since when the 2nd positional argument is omitted the first one already get reinterpreted as the stop point, it is illogical to not expect similar behavior when an alternate step value is provided via a keyword argument. In addition, operator.index is 4-5x faster than the int constructor which leads to a significant performance boost.