[issue44400] Propose random.randbool()

Dong-hee Na report at bugs.python.org
Sat Jun 12 09:13:09 EDT 2021


Dong-hee Na <donghee.na at python.org> added the comment:

To explain my thought,

> Not every one line expression needs to be a function in a library. `bool(getrandbits(1))` is self-explanatory enough,

Yeah, I agree with the point of view, it might be enough.

But considering the popularity of the Python language and there is a lot of new people who enter the programming world with Python for their own purpose so there are a lot of people who are not familiar with the concept of bits.
So I thought that the random module can become more friendly for those people.

And for example, Java/Scala already provides those high-level APIs (and there is a similar proposal at Go also: https://github.com/golang/go/issues/23804). but it does not mean that Python should provide the same APIs. And I know that we also have to consider the maintenance cost and the principle of library scope.

Anyway, this is the reason I proposed this feature and I want to hear the opinion from other core-devs :)

please let me know if I miss something or historical issue.
Enjoy your weekend.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44400>
_______________________________________


More information about the Python-bugs-list mailing list