Created
February 23, 2017 10:52
-
-
Save mfalade/ddca990c8ea908ad757a7f796e6928a9 to your computer and use it in GitHub Desktop.
A simple illustration of the class __getattr__ method
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 Andela: | |
fellows = 'top .5 percent in Nigeria' | |
fellow_list = [1,2,3,4,5] | |
@staticmethod | |
def say_the_chant(): | |
print "Andela Aww Yea!!!!" | |
class SecondClass: | |
def __init__(self): | |
print('asdfas') | |
self.andela = Andela() | |
def __getattr__(self, desired_attr): | |
return getattr(self.andela, desired_attr) | |
first_guy = SecondClass() | |
import pdb; pdb.set_trace() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment