The answer is no.

Do PRIVATE variables EXIST in Python classes?

Many Python tutorials speak of private variables. But can a dynamic language like Python even have private variables? The answer is no. There is no way to protect class attributes from being access from the outside. In this video you see why the visibility of all properties is public in Python.

Written by Loek van den Ouweland on 2023-01-30.
Questions regarding this artice? You can send them to the address below.