inheritance many types have properties in common with other types for exampletypes list and str each have len functions that mean the same thing inheritance provides convenient mechanism for building groups of related abstractions it allows programmers to create type hierarchy in which each type inherits attributes from the types above it in the hierarchy the class object is at the top of the hierarchy this makes sensesince in python everything that exists at runtime is an object because person inherits all of the properties of objectsprograms can bind variable to personappend person to listetc the class mitperson in figure inherits attributes from its parent classpersonincluding all of the attributes that person inherited from its parent classobject class mitperson(person)nextidnum #identification number def __init__(selfname)person __init__(selfnameself idnum mitperson nextidnum mitperson nextidnum + def getidnum(self)return self idnum def __lt__(selfother)return self idnum other idnum figure class mitperson in the jargon of object-oriented programmingmitperson is subclass of personand therefore inherits the attributes of its superclass in addition to what it inheritsthe subclass canadd new attributes for examplemitperson has added the class variable nextidnumthe instance variable idnumand the method getidnum override attributes of the superclass for examplemitperson has overridden __init__ and __lt__ the method mitperson __init__ first invokes person __init__ to initialize the inherited instance variable self name it then initializes self idnuman instance variable that instances of mitperson have but instances of person do not the instance variable self idnum is initialized using class variablenextidnumthat belongs to the class mitpersonrather than to instances of the class when an instance of mitperson is createda new instance of nextidnum is not created this allows __init__ to ensure that each instance of mitperson has unique idnum