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

Publicado em: 10 Agosto 2018
no canal de: 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...


Nesta página do site você pode assistir ao vídeo on-line Python OOP 1: Basic Class, Constructor (__init__) & Destructor (__del__) duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Deep Hobbying 10 Agosto 2018, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 2,049 vezes e gostou 22 espectadores. Boa visualização!