0% found this document useful (0 votes)
6 views5 pages

Understanding MRO and OOP Concepts

The document discusses Method Resolution Order (MRO) in Python, explaining how Python determines the order to look for methods in class hierarchies. It contrasts abstract classes and interfaces, highlighting their features, usage, and responsibilities in object-oriented programming. Additionally, it notes the performance differences between abstract classes and interfaces.

Uploaded by

soniyash4095
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views5 pages

Understanding MRO and OOP Concepts

The document discusses Method Resolution Order (MRO) in Python, explaining how Python determines the order to look for methods in class hierarchies. It contrasts abstract classes and interfaces, highlighting their features, usage, and responsibilities in object-oriented programming. Additionally, it notes the performance differences between abstract classes and interfaces.

Uploaded by

soniyash4095
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Unit- 3 Class and OOP

• MRO : MRO stands for Method Resolution Order. It is the order


in which Python looks for a method in a hierarchy of classes.
• It is possible to see MRO of a class using mro() method of the
class.

class A:
def process(self):
print('A process()')
class B:
pass
class C(A, B):
pass
obj = C()
[Link]()
print([Link]()) # print MRO for class C
Abstract Interface
Sr No.
Class

An abstract
features
developer's All methods of
class can an interface
1.
consist of are abstract
abstract as well
as concrete
methods

It is used when
It is used when all the feature
there are some need to be
2. common implemented
feature shared differently for
by all objects different
objects

Its developer
responsibility Any 3rd person
to create a will responsible
3. child class for for creating a
the features of child class
an abstract
class
It is It is
4. comparatively comparatively
fast slow

You might also like