if we load this class and test it in the interactive interpreterwe can see that it hides the plain text string from the outside worldsecret_string secretstring("acmetop secret""antwerp"print(secret_string decrypt("antwerp")acmetop secret print(secret_string __plain_texttraceback (most recent call last)file ""line in attributeerror'secretstringobject has no attribute '__plain_textit looks like it worksnobody can access our plain_text attribute without the passphraseso it must be safe before we get too excitedthoughlet' see how easy it can be to hack our securityprint(secret_string _secretstring__plain_stringacmetop secret oh nosomebody has hacked our secret string good thing we checkedthis is python name mangling at work when we use double underscorethe property is prefixed with when methods in the class internally access the variablethey are automatically unmangled when external classes wish to access itthey have to do the name mangling themselves soname mangling does not guarantee privacyit only strongly recommends it most python programmers will not touch double underscore variable on another object unless they have an extremely compelling reason to do so howevermost python programmers will not touch single underscore variable without compelling reason either thereforethere are very few good reasons to use name-mangled variable in pythonand doing so can cause grief for examplea name-mangled variable may be useful to subclassand it would have to do the mangling itself let other objects access your hidden information if they want tojust let them knowusing single-underscore prefix or some clear docstringsthat you think this is not good idea