Skip to content

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

StanFromIreland
Copy link
Member

@StanFromIreland StanFromIreland commented Aug 11, 2025

Copy link
Member

@ZeroIntensity ZeroIntensity left a 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:

  1. Do nothing -- it's probably fine as-is.
  2. Note here that objects can raise exceptions in their __bool__ method, and perhaps point to NotImplemented as an example.

@bedevere-app
Copy link

bedevere-app bot commented Aug 11, 2025

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 will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@StanFromIreland
Copy link
Member Author

I have made the requested changes; please review again

(I have made @JelleZijlstra suggested changes.)

@bedevere-app
Copy link

bedevere-app bot commented Aug 11, 2025

Thanks for making the requested changes!

@ZeroIntensity: please review the changes made to this pull request.

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Copy link
Member

@ZeroIntensity ZeroIntensity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

StanFromIreland and others added 2 commits August 11, 2025 22:08
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting merge docs Documentation in the Doc dir skip news
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

3 participants