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

Example of decorator used within a class for its own method #470

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

fPkX6F1nGTX
Copy link

I could not find anything about this explicitly on the Internet. I have tested this and it works.

Copy link

netlify bot commented Jan 10, 2025

👷 Deploy request for pythoncheatsheet pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 369ab47

@fPkX6F1nGTX
Copy link
Author

fPkX6F1nGTX commented Jan 10, 2025

If someone wants to come up with an example of decorating a class method when the method accepts more than just the implicit self argument, please be my guest. I am not able to quickly come up with one, but whoever adds that in should make note of the fact that such a decorator must be defined separately within the class and only used for methods that have explicit arguments, just as the example I gave is only good for methods without them.

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.

1 participant