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 creation is a hack | |
class iShouldntBeAbleToDoAnyOfThis: | |
def __new__(self): | |
#Think long and hard before doing this in reality | |
return theRealClass() | |
def doTheThing(self): | |
print("Do the thing") | |
class theRealClass(): |
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) |