-
-
Save stephengruppetta/41c1db29caff38a6eed4c869c068905d to your computer and use it in GitHub Desktop.
This file contains 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
import functools | |
class Article: | |
def set_platform(self, platform): | |
self.platform = platform | |
# Using partialmethod... | |
set_substack = functools.partialmethod( | |
set_platform, | |
'substack', | |
) | |
article = Article() | |
article.set_substack() | |
print(article.set_substack.func) | |
# <bound method Article.set_platform of <__main__.Article | |
# object at 0x100844e90>> | |
print(article.set_substack.args) | |
# ('substack',) | |
print(article.set_substack.keywords) | |
# {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment