-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Builtin __bool__ docstrings are wrong #90888
Comments
>>> None.__bool__.__doc__
'self != 0' This isn't true, since None does not equal 0. I suggest rewording it to "True if self else False". |
There is no object.__bool__. None.__bool__.__doc__ appears to be an accidental copy of bool/int/float/complex.__bool__.__doc__. It should just be 'False'. |
For whatever reason, all builtins with a __bool__ method appear to share the same docstring. For example, >>> range.__bool__.__doc__
'self != 0'
>>> bool(range(0))
False
>>> bool(range(1))
True The concrete collection classes have their lengths stored internally so bool use that via len(self). But len(range) != 0 iff stop != start. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: