Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:

There is another randrange() oddity.  If stop is None, the step argument is 
ignored:

    >>> randrange(100, stop=None, step=10)
    4

If we want to fully harmonize with range(), then randrange() should only accept 
positional arguments and should not allow None for the stop argument.  That 
would leave the unoptimized implementation equivalent to:

    def randrange(self, /, *args):
        return self.choice(range(*args))

The actual implementation can retain its fast paths and have a nicer looking 
signature perhaps using __text_signature__.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42222>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to