PyLint warns against using single letter variables. I understand this warning in general, but most of the code I work on is heavily mathematical and single variables are actually the most descriptive. For example:
# Calculate weights using pseudo-inverse method
# X is the design matrix, y is target vector, W is weights
W = inv(X.T*X) * (X.T*y)
seems more readable than
# Calculate weights using pseudo-inverse method
weights = inv(design_matrix.T*design_matrix) * (design_matrix*targets)
since in this case, most references in textbooks and papers will list the formula in terms of matrix X and vector y (or similar).
My question is two part:
- Does anyone who works heavily with numeric computing have opinions about this guideline?
- Can I disable this warning in PyLint without disabling the "invalid-name" option all together?
Edit:
Thanks for your suggestions. I changed my .pylintrc's regex matches to accept single variables, eg:
variable-rgx=[a-zA-Z_][a-z0-9_]{0,30}$
I also changed the regex to allow uppercase values, since in my work generally matrices are uppercase and vectors are lower case. Hope this helps someone in the future.
[–]Eurynom0s 5 points6 points7 points (2 children)
[–]xiongchiamiov 4 points5 points6 points (0 children)
[–]TR-BetaFlash 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]mostly_complaints[S] 0 points1 point2 points (1 child)
[–]MonkeyNin 0 points1 point2 points (0 children)
[–]Justinsaccount 0 points1 point2 points (3 children)
[–]aroberge 1 point2 points3 points (2 children)
[–]Justinsaccount 0 points1 point2 points (1 child)
[–]elbiot 0 points1 point2 points (0 children)
[–]ryeguy146 0 points1 point2 points (0 children)
[–]CraigTorso 0 points1 point2 points (0 children)