79244215

Date: 2024-12-02 13:13:53
Score: 1.5
Natty:
Report link

@Eduardo Your solution worked for me with one small change. Currently if you instantiate the class and then add new parameters via set_params(), that change won't be reflected in get_params() because they haven't been added to _param_names. I added one line to fix this:

def set_params(self, **params):
    for param, value in params.items():
        setattr(self, param, value)
        self._param_names.append(param)

    return self

(Posted as an answer as I can't comment yet)

Reasons:
  • Whitelisted phrase (-1): worked for me
  • RegEx Blacklisted phrase (1): can't comment
  • Has code block (-0.5):
  • Looks like a comment (1):
  • Low reputation (1):
Posted by: cleonard