Skip to content

gh-104219: Document that idunders can return NotImplemented #104220

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

Merged
merged 6 commits into from
Mar 1, 2024

Conversation

Gouvernathor
Copy link
Contributor

@Gouvernathor Gouvernathor commented May 6, 2023

I tried to change as little as possible but a broader reformulation, or a separate paragraph explaining that when __iadd__ returns NotImplemented it's the same as if iadd didn't exist at all, could be deemed more readable.


📚 Documentation preview 📚: https://cpython-previews--104220.org.readthedocs.build/

Copy link
Member

@CAM-Gerlach CAM-Gerlach left a comment

Choose a reason for hiding this comment

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

I suggest using the relevant role so that NotImplemented is appropriately formatted and readers can easily jump to more information.

Additionally, you might want to add the role to the adjacent, otherwise-similar descriptions of the __add__ and __radd__ dunders as well (and perhaps explicitly mention for __add__ that the operation falls back to __radd__ if NotImplemented is returned?).

@CAM-Gerlach CAM-Gerlach added the needs backport to 3.11 only security fixes label May 6, 2023
@Gouvernathor
Copy link
Contributor Author

I did that, and in other places too (not in the NotImplemented section itself and only once in some paragraph where it comes up 3 or 4 times).
I think the __add__ explanation is clear enough as it is, since more explanations are given just afterwards, and even then I think it's not really the purpose of this PR.

@erlend-aasland erlend-aasland added the needs backport to 3.12 only security fixes label Feb 29, 2024
Co-authored-by: Jelle Zijlstra <[email protected]>
@erlend-aasland erlend-aasland merged commit 2713c2a into python:main Mar 1, 2024
@miss-islington-app

This comment was marked as outdated.

@erlend-aasland
Copy link
Contributor

Thanks for the report and PR!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 1, 2024
…thonGH-104220)

(cherry picked from commit 2713c2a)

Co-authored-by: Gouvernathor <[email protected]>
Co-authored-by: C.A.M. Gerlach <[email protected]>
Co-authored-by: Jelle Zijlstra <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Mar 1, 2024

GH-116210 is a backport of this pull request to the 3.12 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 1, 2024
…thonGH-104220)

(cherry picked from commit 2713c2a)

Co-authored-by: Gouvernathor <[email protected]>
Co-authored-by: C.A.M. Gerlach <[email protected]>
Co-authored-by: Jelle Zijlstra <[email protected]>
@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Mar 1, 2024
@bedevere-app
Copy link

bedevere-app bot commented Mar 1, 2024

GH-116211 is a backport of this pull request to the 3.11 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.11 only security fixes label Mar 1, 2024
@Gouvernathor Gouvernathor deleted the patch-4 branch March 1, 2024 15:59
@Gouvernathor
Copy link
Contributor Author

Thank you !

erlend-aasland pushed a commit that referenced this pull request Mar 1, 2024
…H-104220) (#116210)

(cherry picked from commit 2713c2a)

Co-authored-by: Gouvernathor <[email protected]>
Co-authored-by: C.A.M. Gerlach <[email protected]>
Co-authored-by: Jelle Zijlstra <[email protected]>
erlend-aasland pushed a commit that referenced this pull request Mar 1, 2024
…H-104220) (#116211)

(cherry picked from commit 2713c2a)

Co-authored-by: Gouvernathor <[email protected]>
Co-authored-by: C.A.M. Gerlach <[email protected]>
Co-authored-by: Jelle Zijlstra <[email protected]>
woodruffw pushed a commit to woodruffw-forks/cpython that referenced this pull request Mar 4, 2024
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 25, 2024
diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants