Created
December 15, 2020 21:22
-
-
Save evandixon/9465da1fa681b3830bafd5df31af7500 to your computer and use it in GitHub Desktop.
Private variables in Python are a mere suggestion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class privateData: | |
def __init__(self): | |
self.__whatever__ = "The Good Value" | |
def doTheThing(self): | |
print(self.__whatever) | |
private = privateData() | |
privateData._privateData__whatever = "The bad value" | |
privateData.doTheThing(private) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment