Skip to content

Conversation

@igopalakrishna
Copy link
Contributor

Summary

This PR addresses issue #35 by refactoring the _TanhNormalProjectionNetworkWrapper class to use the modern, argument-less super() 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.py used the super(_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 call super() 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 is tanh_normal_projection_network.TanhNormalProjectionNetwork. The modern super() 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

  • Updated the __init__ method in _TanhNormalProjectionNetworkWrapper to use super().__init__(...).
  • Updated the call method in _TanhNormalProjectionNetworkWrapper to use super().call(...).

Validation

To ensure this refactoring did not introduce any regressions, the full project test suite was executed using pytest.

  • Test Command: pytest
  • Result: 671 passed, 38 skipped, 0 failed

The successful test run validates that this change is safe and does not impact existing behavior.

Fixes #35

  • Tests pass
  • No documentation changes were necessary for this change.

@ajkhabbazi
Copy link

@s2t2 I reviewed the diff, this is a no-behavior-change refactor that replaces super(_TanhNormalProjectionNetworkWrapper, self) with Python 3 idiomatic super(), matching the intent of issue #35. All CI checks are green and there are no merge conflicts. LGTM; should be safe to merge.

@s2t2
Copy link
Collaborator

s2t2 commented Jan 2, 2026

@igopalakrishna thank you for the fix, and @ajkhabbazi thank you for the review!

Merging... 🚀 🚀 ✨

@s2t2 s2t2 merged commit c230691 into google:copybara_push Jan 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check Inheritance of _TanhNormalProjectionNetworkWrapper

3 participants