Colab

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)

True
isinstance(manager, Manager)

True
isinstance(manager, Temp)

False
issubclass(Temp, Employee)

True
issubclass(Temp, Person)

True
issubclass(Temp, list)

False
issubclass(Temp, Manager)

False
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)

no thank you
x

[<__main__.DifferentList at 0x274939bd898>,
 <__main__.TodoList at 0x274939bd9b0>,
 [7]]
x[1].stuff

[7]
DifferentList.extend = list.extend

dir(Person)

['_Person__my_internal_function',
 '__class__',
 '__delattr__',
 '__dict__',
 '__dir__',
 '__doc__',
 '__eq__',
 '__format__',
 '__ge__',
 '__getattribute__',
 '__gt__',
 '__hash__',
 '__init__',
 '__init_subclass__',
 '__le__',
 '__lt__',
 '__module__',
 '__ne__',
 '__new__',
 '__reduce__',
 '__reduce_ex__',
 '__repr__',
 '__setattr__',
 '__sizeof__',
 '__str__',
 '__subclasshook__',
 '__weakref__',
 'other_function']
x = Person()

x._Person__my_internal_function()

x.blah = []

x.meow = print

x.meow

<function print>
x.blah

[]
x.append = list.append

hasattr

<function hasattr(obj, name, /)>
hasattr(Person, 'meow')

False
hasattr(x, 'meow')

True
hasattr(list, 'append')

True
hasattr(list, 'items')

False
hasattr({1:"one"}, 'items')

True