Skip to content

Conversation

kwankyu
Copy link
Collaborator

@kwankyu kwankyu commented Feb 13, 2024

as discussed in https://groups.google.com/g/sage-devel/c/xzp0sxinCW8/m/RLZ4vGdPAAAJ

📝 Checklist

  • The title is concise, informative, and self-explanatory.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation accordingly.

⌛ Dependencies

@kwankyu kwankyu changed the title Add tips for choosing an exception Add tips for choosing an exception in developer guide Feb 13, 2024
@kwankyu kwankyu marked this pull request as ready for review February 13, 2024 05:56
@grhkm21
Copy link
Contributor

grhkm21 commented Feb 15, 2024

Otherwise looks good to me - @mantepse do you agree?

Co-authored-by: grhkm21 <83517584+grhkm21@users.noreply.github.com>
@mantepse
Copy link
Contributor

In principle I agree, but I think it would be good to post the snippet on sage-devel again, both for advertising and for consensus.

@kwankyu
Copy link
Collaborator Author

kwankyu commented Feb 15, 2024

Instead of carrying around the code, I posted on sage-devel an invitation to come and review this PR.

@mezzarobba
Copy link
Member

Re ArithmeticError vs ZeroDivisionError for non-invertible elements of rings: a possible argument for raising a ZeroElementError would be that, pretty often, if you don't test upfront that the element is invertible and just apply whatever inversion algorithm you have instead, you will indeed end up trying to divide by the zero element of a field. Yet to catch an exception due to something not being invertible I guess it is more robust to test for an ArithmeticError, and then since ZeroDivisionError derives from ArithmeticError it doesn't really matter which one is thrown...

@kwankyu
Copy link
Collaborator Author

kwankyu commented Feb 16, 2024

... Yet to catch an exception due to something not being invertible I guess it is more robust to test for an ArithmeticError, and then since ZeroDivisionError derives from ArithmeticError it doesn't really matter which one is thrown...

Ah, thanks! That is a good point. Perhaps we may mention that in the guide.

@kwankyu kwankyu force-pushed the p/help-choose-errors branch from 7c1a7ec to 57ea33a Compare February 16, 2024 00:56
@kwankyu kwankyu force-pushed the p/help-choose-errors branch from 57ea33a to 31c6e4f Compare February 16, 2024 00:57
Copy link
Contributor

@mkoeppe mkoeppe left a comment

Choose a reason for hiding this comment

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

That's an exceptionally nice addition~

@kwankyu
Copy link
Collaborator Author

kwankyu commented Feb 17, 2024

Thanks for all the comments that improved this PR!

Copy link

Documentation preview for this PR (built with commit e546f92; changes) is ready! 🎉

vbraun pushed a commit to vbraun/sage that referenced this pull request Feb 18, 2024
sagemathgh-37311: Add tips for choosing an exception in developer guide
    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->

as discussed in https://groups.google.com/g/sage-
devel/c/xzp0sxinCW8/m/RLZ4vGdPAAAJ

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#37311
Reported by: Kwankyu Lee
Reviewer(s): grhkm21, Kwankyu Lee, Martin Rubey, Matthias Köppe
vbraun pushed a commit to vbraun/sage that referenced this pull request Feb 19, 2024
sagemathgh-37311: Add tips for choosing an exception in developer guide
    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->

as discussed in https://groups.google.com/g/sage-
devel/c/xzp0sxinCW8/m/RLZ4vGdPAAAJ

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#37311
Reported by: Kwankyu Lee
Reviewer(s): grhkm21, Kwankyu Lee, Martin Rubey, Matthias Köppe
@vbraun vbraun merged commit 0e819af into sagemath:develop Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants