8000 fit_pvsyst_sandia uses a mutable dict keyword argument · Issue #1046 · pvlib/pvlib-python · GitHub
[go: up one dir, main page]

Skip to content
fit_pvsyst_sandia uses a mutable dict keyword argument #1046
Closed
@wholmgren

Description

@wholmgren

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 become CONSTANTS.

  • utility.py is often called utils.py in other packages. We also have a top level tools.py which could be changed too.

thoughts on the above @cwhanse?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0