Python OOP 1: Basic Class, Constructor (__init__) & Destructor (__del__)

Veröffentlicht am: 10 August 2018
auf dem Kanal: Deep Hobbying
2,049
22

Python is an object oriented programming language. Almost everything in Python is an object, with its properties and methods. A Class is like an object constructor, or a "blueprint" for creating objects. Class helps us to group and regroup some of the attributes and function in a way so that it could reuse at later point in the time.

Attributes & Methods:
values of an instance’s variables are called attributes and functions which are being associated with the instance called instance methods.

Constructor & Destructor:
A function or method which execute while defining an instance is call called constructor method, represented by __init__(). It takes instance as a first argument (which by convention we use ‘self’ as a placeholder for that instance). We could also pass other arguments after that using comma as separator.
Unlike constructor, destroyer method runs at last point (in the code, after which there is no uses of class or the instance defined under the same class, anymore). This is represented by __del__(). Destructor clears up class from the memory once the same class is no more in use, which save lot of space in memory.

You could find this tutorial’s presentation & code in the following links:
https://github.com/DeepHobbying/Basic...

https://github.com/DeepHobbying/Basic...


Auf dieser Seite können Sie das Online-Video Python OOP 1: Basic Class, Constructor (__init__) & Destructor (__del__) mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Deep Hobbying 10 August 2018 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 2,049 Mal angesehen und es wurde von 22 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!