Created
February 23, 2017 10:53
-
-
Save mfalade/8f9a244df4b3c680c5a3701c6144e81a 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