Closed
Description
the ivtools
subpackage has code like this:
# utility.py
constants = {'E0': 1000.0, 'T0': 25.0, 'k': 1.38066e-23, 'q': 1.60218e-19}
# sdm.py
from pvlib.ivtools.utility import constants
def fit_pvsyst_sandia(ivcurves, specs, const=constants, maxiter=5, eps1=1.e-3):
The major thing that concerns me is the use of a mutable default. It's generally better practice to use a pattern like const=None
in the signature and then if const is None: const = constants
Other things that I noticed while reporting this:
-
We're starting to consistently follow the recommended practice of formatting module level "constants" in upper case. So
constants
would becomeCONSTANTS
. -
utility.py
is often calledutils.py
in other packages. We also have a top leveltools.py
which could be changed too.
thoughts on the above @cwhanse?