Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up class name and self in calls to super() #628

Merged
merged 1 commit into from
Dec 31, 2022

Conversation

mbrukman
Copy link
Contributor

PEP 3135 1 simplified the syntax for super() in Python 3.0 from:

super(ClassName, self)

to the following very simple and equivalent 2 syntax:

super()

The current Keras codebase already requires Python 3+, and there's a mix of the two syntax formats above, sometimes both are used in a single file.

This change simplifies the entire code base by cleaning up the remaining explicit uses of the current class name and self and using the cleaner super() syntax everywhere consistently.

Since the new syntax is intended to be a shorthand for the old syntax, this change should have no semantic differences from before.

Footnotes

  1. https://peps.python.org/pep-3135/

  2. https://docs.python.org/3/library/functions.html#super

PEP 3135 [^1] simplified the syntax for `super()` in Python 3.0 from:

    super(ClassName, self)

to the following very simple and equivalent [^2] syntax:

    super()

The current Keras codebase already requires Python 3+.

This change simplifies the entire code base by cleaning up the remaining
explicit uses of the current class name and `self` and using the cleaner
`super()` syntax everywhere consistently.

Since the new syntax is intended to be a shorthand for the old syntax, this
change should have no semantic differences from before.

[^1]: https://peps.python.org/pep-3135/
[^2]: https://docs.python.org/3/library/functions.html#super
@mbrukman mbrukman force-pushed the clean-up-super-call-python3 branch from 11b0c18 to 3ba10ea Compare December 30, 2022 22:18
@jbischof jbischof self-requested a review December 31, 2022 02:23
Copy link
Contributor

@jbischof jbischof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution. Welcome to keras-nlp!

@jbischof jbischof merged commit 340a5cc into keras-team:master Dec 31, 2022
@mbrukman mbrukman deleted the clean-up-super-call-python3 branch January 2, 2023 02:20
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.

2 participants