You pretty much got it with the _1
:
- one leading underscore means, yes, this exists, and you can look at it, but another method or property is what you should use instead; consult the docs.
- two leading underscores means, danger! Do not touch or you will seriously break the state and stability of things. Please stay away; if you mess with it, it's all your own fault if something goes wrong.
Note: Using __
is more than just a naming convention as it causes name mangling. This renames the variable to _ClassName__var
. That makes the variable/method harder to use outside of the class. It's primarily done to avoid accidental overrides of methods in parent classes by inherited classes.