Comment on object-orientation

Consider
def write(v): 
    v.write()

write(i)   # i is MySub instance
In C++/Java we would declare v as a MyBase reference and rely on i.write() as calling the virtual function write in MySub
The same works in Python, but we do not need inheritance and virtual functions here: v.write() will work for any object v that has a callable attribute write that takes no arguments
Object-orientation in C++/Java for parameterizing types is not needed in Python since variables are not declared with types

previousnexttable of contents