gh-104219: Document that idunders can return NotImplemented#104220
Conversation
CAM-Gerlach
left a comment
There was a problem hiding this comment.
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?).
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
|
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). |
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This comment was marked as outdated.
This comment was marked as outdated.
|
Thanks for the report and PR! |
…thonGH-104220) (cherry picked from commit 2713c2a) Co-authored-by: Gouvernathor <44340603+Gouvernathor@users.noreply.github.com> Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
|
GH-116210 is a backport of this pull request to the 3.12 branch. |
…thonGH-104220) (cherry picked from commit 2713c2a) Co-authored-by: Gouvernathor <44340603+Gouvernathor@users.noreply.github.com> Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
|
GH-116211 is a backport of this pull request to the 3.11 branch. |
|
Thank you ! |
…thon#104220) Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
…thon#104220) Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
…thon#104220) Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
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/