Lesson-22 | Method Resolution Order & super() function | [OOP in Python]

preview_player
Показать описание
This is the lesson number 22 of the lesson series on Object Oriented Programming (OOP) in Python. It will be a complete course with the aim is to cover almost everything needed in Object Oriented Programming.

In this lesson we will discus about MRO (Method Resolution Order) which is important to work with class inheritance. Moreover we will learn about the super() function.

Link to complete playlist:

Floating Point arithmetic limitations:

Lesson Code:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*Review Questions of the Lesson*
1- What is the default object class.
2- Describe one case where hasattr() can be useful.

#OOP #ObjectOrientedProgramming #Python
Рекомендации по теме
Комментарии
Автор

Nice lecture as usual ..keep on uploading more...thank u

Astromoola
Автор

1- There is an object class from which all other classes are inherited
2- hasaatr() can be useful if applying checks on various statement like
if hasattr(class, attribute):
if true: return True
else: return false

shahrozahmed
Автор

1. Parent class of all classes.
2. hasattr() can be used to check the presence of an attribute in a class in a lengthy code.

haris
Автор

1_ Default object class is the primary class that is the parent class of all the classes defined in python. It has useful and common attributes and functions that are needed for the proper working of a class.

ahmadiftikhar
Автор

1- Default object class is Parent class of all classes.
2- hasattr() comes handy while checking for presence of an attribute in a class in a lengthy code

muhammadalihaider
Автор

1: Parent class of all classes.
2: hasattr() can be used to check the presence of an attribute in a class in a lengthy code.

AsadAli-owie
Автор

2- when writing codes for search engines for example ( a periodic table ) you can use hasattr or getattr very efficiently to search a data attribute entered by the end user. hasattr would help in displaying a proper message, if the object ( element ) doesn't have a certain data attribute.

ahmadhussain
Автор

2. It can be used for comparison purposes. To check if more than one classes share the same attribute. Or to check if a class is a child class of some parent class.

noorulain
Автор

1- Default class is the parent class of all child classes.
2- hasattr() is used to check whether an attribute exists in class

amaanmajid
Автор

1- The default object class is the parent class of all the classes.
2- We can check presence of an attribute in a class using hasattr() that can be useful for lengthy codes.

usman_tariq
Автор

1- By default object class is a built-in class in python which is the parent class of every other classes.
2- hassattr() can be used in checking the attributes which can be accessible in child class and useful in checking the attributes of a child class.

alizaman
Автор

1: Default class is the parent class of all classes
2: hasattr() can be used to check for an attribute in class.

maleehasyed
Автор

2: This function can be used to check keys to avoid unnecessary errors in case of accessing absent keys. Chaining of hasattr() is used sometimes to avoid entry of one associated attribute if other is not present.

saifullahafzal
Автор

2) let an attribute is supposed to be created in a method which is not yet called and the same attribute is used by some other method so to avoid traceback it can first check whether is has been created or not.
let a method fill a grid and a method generates a list which is an attribute and will be used by fill method later. but if we call fill first, the list attribute is not yet created so we can take proper action by using hasattr().

danishbismillah
Автор

1- Default object class is the parent class of all the child classes.
2- We can use hasattr() with conditions (if else etc) to check whether a class has an attribute or not.

irfansaleem
Автор

1- Parent class.
2-hasattr() can be used to check the specific attribute either exist or not .

yusrakashif
Автор

1-Parent class.
2-We can use hasattr() to first check the existence of an attribute in a class before using it.

habibaasif
Автор

2_ hasattr() is usually used for testing purposes and debugging processes. It can be used in checking the availability of a certain attribute in a class while dealing with multiple classes.

ahmadiftikhar
Автор

2. hasattr() can be used to check whether certain attribute exists or not . It usually happens in lengthy codes. If certain attribute is not present than raise an error

syedfarazabbas
Автор

2. Useful in checking the presence of an attribute in a class.

faryalnasir
welcome to shbcf.ru