class C: def normal_method(self, a, b): print(self, a, b) @classmethod def class_method(cls, a, b): print(cls, a, b) @staticmethod def static_method(a, b): print(a, b) instance = C() i = 123 d = {} s = 'abc' for line in """ . Alternating between user class and built-in class. . Method through instance: instance.normal_method (3).__add__ . Class method through instance: instance.class_method {}.fromkeys . Static method through instance: instance.static_method '123'.maketrans . Method through class: C.normal_method int.__add__ . Class method through class: C.class_method dict.fromkeys . Static method through class: C.static_method str.maketrans . Method through class dict: C.__dict__['normal_method'] int.__dict__['__add__'] . Class method through class dict: C.__dict__['class_method'] dict.__dict__['fromkeys'] . Static method through class dict: C.__dict__['static_method'] str.__dict__['maketrans'] """.strip().split('\n'): line, _, comment = line.partition('#') line = line.strip() if not line: continue if line.startswith('.'): print() print(line[1:].strip()) continue o = eval(line) print(" ", line.ljust(30), "callable?", callable(o))