refactor: Modernize super() calls in sac_networks #114
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.
Summary
This PR addresses issue #35 by refactoring the
_TanhNormalProjectionNetworkWrapperclass to use the modern, argument-lesssuper()syntax. This change improves code readability and aligns the codebase with current Python 3 best practices without altering functionality.Technical Explanation
The previous implementation in
sac_networks.pyused thesuper(_TanhNormalProjectionNetworkWrapper, self)syntax. While functionally correct, this is an explicit and verbose style inherited from Python 2. It can be confusing as it appears to callsuper()on the class itself.The goal of
super()is to call the method from the parent class in the Method Resolution Order (MRO), which in this case istanh_normal_projection_network.TanhNormalProjectionNetwork. The modernsuper()call automatically handles this, making the code cleaner, more maintainable, and less prone to copy-paste errors if the class were ever to be renamed.This refactoring replaces the outdated calls with
super(), which is the idiomatic standard in Python 3.Changes Made
__init__method in_TanhNormalProjectionNetworkWrapperto usesuper().__init__(...).callmethod in_TanhNormalProjectionNetworkWrapperto usesuper().call(...).Validation
To ensure this refactoring did not introduce any regressions, the full project test suite was executed using
pytest.pytestThe successful test run validates that this change is safe and does not impact existing behavior.
Fixes #35