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 steven.daprano
Recipients corona10, rhettinger, steven.daprano
Date 2021-06-12.04:22:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1623471771.27.0.241635958969.issue44400@roundup.psfhosted.org>
In-reply-to
Content
Not every one line expression needs to be a function in a library. `bool(getrandbits(1))` is self-explanatory enough, and it is doubtful that any implementation would be faster.

Using getrandbits(1) to return 0 or 1 is fine; if you need a bool, call bool on the result.

Aside: the name getrandbits is a bit sad, there's no setrandbits and we don't name the other random functions with a leading "get" prefix:

    getrandint(1, 6)


Raymond, would you consider providing an alias randbits and depreciating the getrandbits name? We don't have to remove it, just document it as depreciated to be removed in Python 5000 :-)
History
Date User Action Args
2021-06-12 04:22:51steven.dapranosetrecipients: + steven.daprano, rhettinger, corona10
2021-06-12 04:22:51steven.dapranosetmessageid: <1623471771.27.0.241635958969.issue44400@roundup.psfhosted.org>
2021-06-12 04:22:51steven.dapranolinkissue44400 messages
2021-06-12 04:22:50steven.dapranocreate