At
https://github.com/sagemath/sage/pull/40875, Frédéric is harmonizing the prefix of the names of methods returning the number of facets (points, vertices, parts, etc.) of polytopes to `n_facets`, before it was `nfacets`.
While I think this is very good, I would rather go one tiny step further, and harmonize both to `number_of_facets`, or, in fact, just make `number_of_facets` an alias.
My question here is: is anybody strictly against this? More precisely:
Any method returning the number of some components of a structure should be named `number_of_xxx`, other aliases are OK.
I did a quick grep, the current situation is as follows:
grep -r --include=*.{py,pyx} --color=auto -nH --null -e "def[^(]* number_of_.*(" *
125 matches
grep -r --include=*.{py,pyx} --color=auto -nH --null -e "def[^(]* num_.*(" *
22 matches
most important example: graph.num_verts
grep -r --include=*.{py,pyx} --color=auto -nH --null -e "def[^(]* n_.*(" *
97 matches
mostly geometry/polyhedron
most important example for nxxx is of course ngens, and I'm afraid we shouldn't rename that one. But there is also `nvars` (in sat/solvers), `ncols` and `nrows` for matrices, `ncusps` in `arithgroup`, and the polytope methods.
Finally, there are a few really odd ones, which I stumble across every other month (and hate):
combinat/binary_tree.py:1752: def left_children_node_number(self, direction='left'):
combinat/binary_tree.py:2600: def hook_number(self):
combinat/abstract_tree.py:1159: def node_number(self):
combinat/permutation.py:2442: def longest_increasing_subsequences_number(self):
combinat/posets/posets.py:2714: def relations_number(self):
Martin