Improve subclass binding when __init__ is not defined. #17
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have a lot of subclasses of an abstract base class. The subclasses all use the the base's
__init__
, and so I don't explicitly write out the__init__
for each. However, this is causing an issue in argbind when I want to configure the kwargs in the init of each subclass differently. It ends up not configuring the kwargs at all and leaves them at their defaults.Example of the current argbind:
Notice that it didn't pass the requested
config
and instead left it as None.With this PR, the last section is instead:
I also updated
examples/bind_existing/with_argbind.py
to make more sense to me. It produces the same output as before, but I changed some code. I think it's confusing to put the superclassMyClass
in the args/yaml. To me, it makes more sense to be able to put the subclassBoundClass
.