Created
August 16, 2022 18:49
-
-
Save pwtail/0f3c7c6c36fd6932b8834215f164dd28 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
class Super: | |
def __get__(self, instance, owner): | |
parent = super(self.owner, instance) | |
return getattr(parent, self.name) | |
def __set_name__(self, owner, name): | |
self.name = name | |
self.owner = owner | |
class A: | |
def f(self): | |
return self | |
class B(A): | |
f = Super() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment