Conversation
e068707 to
2ffd089
Compare
2ffd089 to
2eb8a0e
Compare
| pmat_type = pmat_type or self.pmat_type | ||
| for k, v in tuple(kwargs.items()): | ||
| if v is None: | ||
| kwargs.pop(k) |
There was a problem hiding this comment.
This is really obscure. Why are those options disallowed?
There was a problem hiding this comment.
If we pass sub_mat_type=None we would like to grab the one from the parent _SNESContext. Basically this enables
sub_mat_type = kwargs.get("sub_mat_type") or self.sub_mat_type
but more generically
There was a problem hiding this comment.
The line below kwargs.setdefault("sub_mat_type", self.sub_mat_type) is a no-op if submat_type=None is already in the dictionary.
There was a problem hiding this comment.
Should the lines below be changed to something like
kwargs["sub_mat_type"] = kwargs.get("sub_mat_type") or self.sub_mat_type
?
There was a problem hiding this comment.
Yeah I think that's much better
There was a problem hiding this comment.
That will potentially cause conflicts with empty dictionaries or empty strings
There was a problem hiding this comment.
We need
def set_default_kwarg(kwargs, key, default):
if kwargs.get(key) is None:
kwargs[key] = default
set_default_kwarg(kwargs, "sub_mat_type", self.sub_mat_type)
...
There was a problem hiding this comment.
How so?
reconstruct should keep the original arguments if they are not passed as kwargs or if they are set to None in the kwargs. Sometimes one might need to pass appctx={} or options_prefix="", which are falsy values that we should not treat as None.
There was a problem hiding this comment.
Explicitly filtering Nones like that is also fine. I just don't like the premature filtering of all kwarg options.
3040d36 to
96ea75a
Compare
Description