-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
gh-89152: Note truth testing exception in stdtypes.rst
#137640
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As currently written, I'm not sure this is an improvement. I don't think NotImplemented
should be special here, because it's pretty easy to implement something yourself that also fails as a truth value:
class Test:
def __bool__(self):
raise TypeError
if Test(): # TypeError
pass
We should do one of two things:
- Do nothing -- it's probably fine as-is.
- Note here that objects can raise exceptions in their
__bool__
method, and perhaps point toNotImplemented
as an example.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
I have made the requested changes; please review again (I have made @JelleZijlstra suggested changes.) |
Thanks for making the requested changes! @ZeroIntensity: please review the changes made to this pull request. |
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This was implemented in 3c079a0
📚 Documentation preview 📚: https://cpython-previews--137640.org.readthedocs.build/