class Person:
def __my_internal_function(self):
pass
def other_function(self):
pass
class Employee(Person):
pass
class Temp(Employee):
pass
class Manager(Employee):
pass
manager = Manager()
temp = Temp()
isinstance(manager, Person)
isinstance(manager, Manager)
isinstance(manager, Temp)
issubclass(Temp, Employee)
issubclass(Temp, Person)
issubclass(Temp, list)
issubclass(Temp, Manager)
class DifferentList:
def append(self, other):
print('no thank you')
class TodoList:
stuff = []
def append(self, other):
self.stuff.append(other)
x = [DifferentList(), TodoList(), []]
for item in x:
item.append(7)
x
x[1].stuff
DifferentList.extend = list.extend
dir(Person)
x = Person()
x._Person__my_internal_function()
x.blah = []
x.meow = print
x.meow
x.blah
x.append = list.append
hasattr
hasattr(Person, 'meow')
hasattr(x, 'meow')
hasattr(list, 'append')
hasattr(list, 'items')
hasattr({1:"one"}, 'items')