Improve subclass binding when __init__ is not defined.#17
Open
DBraun wants to merge 1 commit intopseeth:mainfrom
Open
Improve subclass binding when __init__ is not defined.#17DBraun wants to merge 1 commit intopseeth:mainfrom
DBraun wants to merge 1 commit intopseeth:mainfrom
Conversation
Author
|
@pseeth @seethlord can you take a look? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
configand instead left it as None.With this PR, the last section is instead:
I also updated
examples/bind_existing/with_argbind.pyto 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 superclassMyClassin the args/yaml. To me, it makes more sense to be able to put the subclassBoundClass.