To my mind, it does not hurt to have these `factory.X` as CamelCase or snake_case. The reason is that the factory should be thought of as a Python module (which contains both objects and functions). I agree that it would be nice to uniformize that a bit (and update the developer guide once we have reasonable guidelines).
Note that sage: groups.<TAB> which is furthermore refined in sage: groups.affine.<TAB> sage: groups.lie.<TAB> etc also uses CamelCase. Le 14/02/2020 à 15:00, Michael Orlitzky a écrit :
An official bikeshed thread! We have a number of grouped factory methods to construct familiar objects. Some of them use CamelCase for their method names: sage: graphs.<tab> sage: manifolds.<tab> sage: valuations.<tab> Some use underscores for their method names: sage: polytopes.<tab> Some can't make up their minds: sage: designs.<tab> sage: toric_varieties.<tab> To confound matters, when an object has an "official" name in either upper- or lower-case, we tend to use that rather than follow a convention in the first place. In ticket #26623, I need to pick one for the "cones" object. PEP8 says that, since these are method names, they should use underscores. And the sage developer guide says to follow PEP8: http://doc.sagemath.org/html/en/developer/coding_basics.html But it also says Use CamelCase for class names... and factory functions that mimic object constructors, for example PolynomialRing. That makes complete sense for top-level functions like PolynomialRing. Should it apply to *methods* that also act like constructors, even though visually, something like cones.Foo() doesn't look like a constructor (it looks like a method)? Can we pick one style and write it down to avoid this problem in the future? FWIW, I think cones.trivial() looks better than cones.Trivial(), but for no good reason. I think it's just because I haven't seen method names capitalized in a long time.
-- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/aaf5d53c-d125-2564-e71a-57b7aa13e5e6%40gmail.com.