How to method or variable fully private in class in python | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

How to method or variable fully private in class in python

25th Feb 2019, 3:21 AM
Arpit Jain
Arpit Jain - avatar
4 Antworten
25th Feb 2019, 4:32 AM
Gordon
Gordon - avatar
+ 2
Hm... HonFu is right. Python has no truly private variable for class https://www.sololearn.com/learn/Python/2471/
26th Feb 2019, 4:06 AM
Gordon
Gordon - avatar
0
Python is not meant to have that. When you want a variable to be private, you let them start with a _. This is the signal for another coder not to touch it.
25th Feb 2019, 7:17 AM
HonFu
HonFu - avatar
0
But it can be access out side the class
26th Feb 2019, 3:10 AM
Arpit Jain
Arpit Jain - avatar