Skip to content

Conversation

fchapoton
Copy link
Contributor

@fchapoton fchapoton commented Sep 25, 2025

This replaces methods num_points and num_blocks by n_points and n_blocks in designs.

Old names are kept as aliases.

cf also #40875

This is just a small reduction of the number of method with names num_*

📝 Checklist

  • The title is concise and informative.
  • 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 and checked the documentation preview.

Copy link

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

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.

Thanks for the contribution!

If you want the aliases to be deprecated eventually you can use this: https://doc.sagemath.org/html/en/reference/misc/sage/misc/superseded.html#sage.misc.superseded.deprecated_function_alias

If you don't want the aliases to get deprecated then this is fine. My suggestion to change the functions that return int to Integer is an "if you want to" suggestion, this PR is already an improvement and I won't insist on expanding the scope.

I'm happy with this as-is, if you are too feel free to set to positive review. If you want to make the additional changes I suggested (marking the functions as deprecated aliases or changing int to Integer) then tag me when it's ready for review again.

sage: designs.DesarguesianProjectivePlaneDesign(2).num_points()
7
"""
return len(self._points)
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason this returns int instead of Integer? If not, you could change this to return an Integer.

@vincentmacri
Copy link
Member

I just saw the discussion in #40875 about deprecations, I take back my suggestion to deprecate the aliases since there are some good reasons to not deprecate these names. If you want to make the int to Integer change feel free and I'll review it again, otherwise you can set this to positive review.

@fchapoton
Copy link
Contributor Author

thanks for the review. I choose to set to positive.

@mantepse
Copy link
Contributor

@fchapoton, will you also do the remaining num_xxx? If you don't, I would just introduce aliases for the following:

coding/binary_code.pyx:1893:    cdef int num_cells(self, int k) noexcept:
databases/knotinfo_db.py:239:    def num_knots(self, version):
graphs/base/c_graph.pyx:1421:    def num_edges(self, directed):
graphs/base/c_graph.pyx:1524:    def num_verts(self):
graphs/base/graph_backends.pyx:586:    def num_edges(self, directed):
graphs/base/graph_backends.pyx:608:    def num_verts(self):
graphs/base/static_sparse_backend.pyx:983:    def num_verts(self):
graphs/base/static_sparse_backend.pyx:1046:    def num_edges(self, directed):
graphs/generic_graph.py:6990:    def num_faces(self, embedding=None):
groups/perm_gps/partn_ref/refinement_python.pyx:117:    def num_cells(self):
knots/knotinfo.py:874:    def num_components(self):
lfunctions/pari.py:578:    def num_coeffs(self, T=1):
lfunctions/dokchitser.py:348:    def num_coeffs(self, T=1):
modular/modform_hecketriangle/hecke_triangle_group_element.py:2739:            sage: def num_linking_number(A, z, n=3, prec=10, num_prec=53):
modular/etaproducts.py:665:def num_cusps_of_width(N, d) -> Integer:
schemes/product_projective/space.py:566:    def num_components(self):

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.

3 participants