Python POOP: "name mangling"--how to make class data private or public (odd in Python!)
https://www.youtube.com/watch?v=6cvFzLB6hbA they way Python OOP ("Poop") deals with private and public data in classes is strange indeed. by default all class attributes and methods are public (so, no encapsulation, of any kind, at all) There is no reserved words "public" private protected that the interpreter recognizes. To get around this python employs "name mangling": __x = 7 two underscores means the variable or method is private to the class. If you go outside the class and try to print __x you get an error. However, you can still see the value for this name-mangled variable: _classname.__x (one underscore classname, dot, two underscores, variable name) So it's not really private, it is psuedo-private. Whatever.