-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
Open
1 / 11 of 1 issue completedOpen
1 / 11 of 1 issue completed
Copy link
Labels
pendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is providedstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
Support of the __index__() method in getrandbits() and randbytes() is inconsistent.
Random.getrandbits()supports__index__(), butSystemRandom.getrandbits()does not.SystemRandom.randbytes()supports__index__(), butRandom.randbytes()does not.
For consistence, both classes should support it.
sample() fails if its k argument is not integer. k should have __index__(), but it also should support comparison with integers and multiplication by list and integer. It is easy to make it more general, and only require __index__(). It will also produce more meaningful error.
binomialvariate() seems "working" with non-integer n argument, but the result is questionable. Passing non-integer value is most likely an error, and it would be better to detect it.
cc @rhettinger
Sub-issues
Metadata
Metadata
Assignees
Labels
pendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is providedstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement