New issue 3123 by Ronan.L...@gmail.com: Naming conventions in sympy/stats/
http://code.google.com/p/sympy/issues/detail?id=3123
There are a number of PEP8-violating names in sympy.stats:
* Density, Where, Given, Sample, CDF, Skewness: these are functions, so
their name should be lowercase.
* Covar: the conventional notation is Cov, not Covar.
* P, E: these names are too short. It's debatable whether P and E are
appropriate shortcuts, but they are clearly unsuitable as primary names
shown in documentation and tracebacks.
Comment #1 on issue 3123 by asme...@gmail.com: Naming conventions in
sympy/stats/
http://code.google.com/p/sympy/issues/detail?id=3123
(No comment was entered for this change.)
* Density, Where, Given, Sample, CDF, Skewness: these are functions, so
their name should be lowercase
These were originally intended to be classnames like Add, Mul. I'm not sure
that that's the plan any longer. I agree that these should be changed
* Covar: the conventional notation is Cov, not Covar.
agreed
* P, E: these names are too short. It's debatable whether P and E are
appropriate shortcuts, but they are clearly unsuitable as primary names
shown in documentation and tracebacks.
I strongly believe that at least the user interface should include these
function names. P(X>1) looks good enough to warrant the deviation from
style. These functions are also not in the general sympy namespace so its a
bit less important. Making them aliases to other more verbosely named
functions seems like a good compromise.
I'll get to this in a week or two if no one else does beforehand.
But E is euler's constant. If we don't want one letter names for P, I think
I've seen Pr used to denote probability. If not, Prob maybe? Exp would
cause confusion with exp. What about Ex?
E->Ex->Exp->Expectation
P->Pr->Prob->Probability
I like the two letter names--unambiguous but still short.
For me making code look like math is a high priority. E and P are the
standard ways to represent expectation and probability and so I'll back
them to the extent that they don't cause big upsets.
I think it's ok if we collide with other SymPy names because we're in a
module, not the core. If sympy.stats were to be part of the core or
imported by default then it would be very different.
Comment #5 on issue 3123 by MRock...@gmail.com: Naming conventions in
sympy/stats/
http://code.google.com/p/sympy/issues/detail?id=3123
Questions:
What should we do with var?
Var violates PEP8
var conflicts with sympy.var
I think the options are to go ahead and conflict with var or to just use
the full name, variance.
Depending on this choice we'll probably change Covar/covar/cov/covariance
to match
There is a pull request linked above. If no one comments in the couple days
I'll probably use variance/covariance and merge.
Var() seems fine to me, especially if you're going to keep using short
names for everything else.
There's no reason why you can't have both long and short names, too. Just
define it as the long name in the file and do shortname = longname.
The issue with Var is that it violates PEP8. If we decide to go ahead with
capitalized Var then should we also do capitalized Cov, Std, Skewness,
Density, Sample, Given etc...?
It seems to me that using plain variance is simpler. This is also the
solution that makes the fewest choices. We can add aliases in the future
but can't take them away. In any event this isn't that big of a deal. I
just want to make things reasonable for the .72 release.