Python Tutorial for Beginners 26 - Is it possible to define multiple constructors in Python?

preview_player
Показать описание
In this Python Tutorial for Beginners video I am going to show if it Is possible to define multiple constructors in Python?.
Unlike Java or C++, we cannot define multiple constructors in python. but, we can define a default value if one is not passed or we can use *args, **kwargs as arguments.
So what does the __init__ method do in python ? __init__ method is used as a constructor for the class. Usually __init__ does some initialization work e.g. initialize attributes and other functions.The arguments passed to the class name are given to its __init__() method. It would be incorrect to call __init__ constructor of the class.But __init__ is the closest thing we're going to get in Python to a constructor.
And what is self in python - self is the first argument of every method is a reference to the current instance of the class. self keyword is similar to the keyword this in Java or C++.

#PythonTutorialforBeginners #ProgrammingKnowledge #LearnPython #PythonCourse
★★★Top Online Courses From ProgrammingKnowledge ★★★

★★★ Online Courses to learn ★★★

★★★ Follow ★★★

DISCLAIMER: This video and description contains affiliate links, which means that if you click on one of the product links, I’ll receive a small commission. This help support the channel and allows us to continue to make videos like this. Thank you for the support!
Рекомендации по теме
Комментарии
Автор

Just excellent!! The way you explained is really helpful for the beginners. I was watching from the first tutorial and just want to say you thanks a lot :)

biyasbanerjee
Автор

By the end of this course I'll be also saying 'paraMeter' but that's a good price to pay, tho. Excellent videos, man, keep up the good work :D

danieloliveira
Автор

Is there any option put multiple likes** for your videos?
Excellent videos ...!

RemshidAbdulSathar
Автор

Sir hardware video for laptop full details and repair
Thanks

SanjayKumar-tslo
Автор

but how to access that dictionary words if provided through **kwargs please help me i am not able to access
that

RelaxingMusic-dvtk
Автор

How do we apply the Print Statement in above argument = *args or **kwargs

adityakalra