This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients rhettinger, serhiy.storchaka, tim.peters
Date 2020-12-28.21:06:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1609189611.52.0.500868166925.issue42772@roundup.psfhosted.org>
In-reply-to
Content
Another solution is to use an identity test for the step argument

    _one = 1

    class Random:
        def randrange(start, stop=None, step=_one):
            ...
            if stop is None and step is _one:
                if istart > 0:
                    return self._randbelow(istart)

This has the advantage of keeping the API unchanged while still keeping the fast path fast.
History
Date User Action Args
2020-12-28 21:06:51rhettingersetrecipients: + rhettinger, tim.peters, serhiy.storchaka
2020-12-28 21:06:51rhettingersetmessageid: <1609189611.52.0.500868166925.issue42772@roundup.psfhosted.org>
2020-12-28 21:06:51rhettingerlinkissue42772 messages
2020-12-28 21:06:51rhettingercreate