OOP: Encapsulation in python

Pubblicato il: 24 aprile 2022
sul canale di: Python Russian
17,016
708

Let's consider one of the 3 pillars of OOP - encapsulation, see what it is and what is better not to expect.

Encapsulation implies collecting data and methods for working with them in one place (class), as well as providing a public interface (API) for working with them.

In Python, the underscore _ is used to mark the internal implementation, that is, attributes that are not related to the public interface.

One underscore (protected) is just a signal, the interpreter treats such attributes as ordinary ones.
Two underscores (private) - includes the Name Mangling mechanism, which is not intended to hide data.

Encapsulation in Python does not imply hiding data (in some languages, this is the same thing) - all data is available for viewing and changing. In Python, we do not try to take away tools from the user, we warn.

👣OOP First Steps    • Первые шаги в ООП: класс, объект, self  
🐣OOP: Inheritance    • ООП: Наследование (Inheritance)  

Join in helping the channel, it will be interesting)
✔️Boost https://boosty.to/python_russian/donate
✔️Yumani 410011506612886

Be the first everywhere and always, turn on notifications about new releases 🔔

Watch where it is convenient🤩
✔️ https://vk.com/python_russian
✔️ https://rutube.ru/channel/24346352/
✔️ https://dzen.ru/python_russian

✔️    / pythonrussian  
✔️ https://t.me/python_russian

#Python #PythonRussian #PyCharm


In questa pagina del sito puoi guardare il video online OOP: Encapsulation in python della durata di online in buona qualità , che l'utente ha caricato Python Russian 24 aprile 2022, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 17,016 volte e gli è piaciuto 708 spettatori. Buona visione!