Closed lebrice closed 1 year ago
Note: This issue was created in response to another one here: #191
I've now allowed functools.partial
objects to be used in the subgroups dict. This should make it much easier to configure different versions of the same dataclass.
https://github.com/lebrice/SimpleParsing/pull/196#issue-1529939433
I don't currently see a good reason to use lambdas in subgroups. The one use that makes sense is for the default_factory. But for now, I'm still disabling it, for the reasons mentioned in #196.
Closing this for now, but if anyone has an issue with this, please feel free to reopen and we'll discuss this.
Is your feature request related to a problem? Please describe.
In #185, I significantly reworked the
subgroups
feature. In order to keep the size of the PR under control, I had to make a few simplifying assumptions, namely:subgroups
dict are all dataclasses typesdefault
, when passed, is a key of the dictionarydefault_factory
, when passed, is a value in the dictionary.Describe the solution you'd like
Allow passing, at the very least:
functools.partial
objects as values and default factorylambda: SomeDataclassType(...)
Additional context Subgroups also work really nicely in conjunction with the
Partial
classes of #156. These currently are just dataclasses, so they can be used with subgroups.