Skip to content

Conversation

fchapoton
Copy link
Contributor

@fchapoton fchapoton commented Jun 2, 2025

as a sequel of #40123

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.

Copy link

github-actions bot commented Jun 4, 2025

Documentation preview for this PR (built with commit 6680d1f; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

@fchapoton
Copy link
Contributor Author

@vincentmacri @tobiasdiez could you please have a look ?

Copy link
Member

@vincentmacri vincentmacri left a comment

Choose a reason for hiding this comment

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

Looks good, one suggestion that you can take if you want.

@@ -1273,7 +1273,7 @@ def tamagawa_number(self, P, proof=None):

return self.local_data(P, proof).tamagawa_number()

def tamagawa_numbers(self):
def tamagawa_numbers(self) -> list:
Copy link
Member

Choose a reason for hiding this comment

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

I think this can be list[Integer] but if you want to leave specifying list types for future work that's fine too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would prefer not. One point is that imho we should discuss and decide before moving forward : whether or not to distinguish between python integer and Sage Integer or just use a new abstract t_Integer class for typing. We should also talk about what kind of type we should use for polynomials.

Copy link
Contributor

Choose a reason for hiding this comment

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

If the return/input type is clear, then you can use the specific Python int or sage Integer class. For the case where either can be returned, I would say something like

type Intlike = int | sage.Integer

should work.

Copy link
Member

Choose a reason for hiding this comment

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

Doesn't Sage use its own Integer type everywhere (or at least it should)? I think the only place where we would return a python integer is in magic methods like __len__ or __hash__.

This is a more complicated matter for function parameters where many Sage functions (but not all) accept python ints.

Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't Sage use its own Integer type everywhere (or at least it should)? I think the only place where we would return a python integer is in magic methods like len or hash.

It's a somewhat stupid test, but there are over 1000 instances of return 0. But yeah, most methods should return sage integer.

@vbraun vbraun merged commit 836bba3 into sagemath:develop Jun 14, 2025
30 of 31 checks passed
@fchapoton fchapoton deleted the further_has_methods_typing branch June 15, 2025 06:12
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.

4 participants