Skip to content
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

Remove __nonzero__ method from models.Response #6207

Closed
wants to merge 1 commit into from

Conversation

sobolevn
Copy link

@sobolevn sobolevn commented Jul 30, 2022

__nonzero__ was used in python2 as we now use __bool__. It is not used at all in python3.
And since setup.py says that reqeusts supports only python >= 3.7, I don't think that it is really required.

I found this while working on typeshed types for requests: https://github.com/python/typeshed/blob/3fe1f5d6c46b39b8b4632aadc70477a729241d25/stubs/requests/requests/models.pyi#L107

@nateprewitt
Copy link
Member

Hi @sobolevn,

Thanks for the PR, but I think we’re unlikely to remove this. The use of super().__nonzero__() to implement __bool__ in subclasses was quite popular when the Python 3 migration started. There’s a high chance this will be breaking if we remove the function entirely.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants