May 2021
Intermediate to advanced
142 pages
3h 37m
English
Sometimes Python can feel like a bit of the wild wild west—this can feel especially true for programmers coming from a language like Java where variables and classes can be explicitly scoped as public, private, protected, and so on. In this section, you’ll learn more about how variable privacy works in Python so you better understand how to protect your programs from unexpected manipulation.
Python programs do not support truly private variables, methods, or functions. Anything you define in a Python file can be discovered and potentially mangled by other parts of your program.
Let’s consider an example class representing a dinosaur egg that can hatch:
| | class DinosaurEgg: ... |