Created
May 12, 2020 19:21
-
-
Save jerome-diver/71ebe54b33d2a6e9a13bf25a8cfd9301 to your computer and use it in GitHub Desktop.
How super mixins can find metaclass child variable
This file contains hidden or 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 MixinsBuilder: | |
"""From child static variable, i'm going to build attributes""" | |
def build_attributes(self): | |
my_meta_var = self.???[0] | |
for k, v in my_meta_var: | |
if not hasattr(self, k): | |
setattr(k, v) | |
class A(MixinsBuilder): | |
__schmurf = dict() | |
class B(MixinsBuilder): | |
__things = dict() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment