bpo-33144: random.Random and subclasses: split _randbelow implementation by wm75 · Pull Request #6291 · python/cpython (original) (raw)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Serhiy is correct in pointing out the _randbelow() is an implementation detail. We really don't want people using (overriding) this non public api.

Let's not feature-creep this optimization patch. Ideally, it should be the smallest possible change that moves algorithmic decision to class instantiation time.

Also, any possible "bug fix" to change the exception raised should be in a separate PR. Unless we've guaranteed a particular exception (which is not usually the case), the C code is allowed to differ in small ways from the Python code. That isn't to say that it shouldn't be changes, but that it is a separate discussion.