Skip to content

Instantly share code, notes, and snippets.

@jerome-diver
Created May 12, 2020 19:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jerome-diver/71ebe54b33d2a6e9a13bf25a8cfd9301 to your computer and use it in GitHub Desktop.
Save jerome-diver/71ebe54b33d2a6e9a13bf25a8cfd9301 to your computer and use it in GitHub Desktop.
How super mixins can find metaclass child variable
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