Problem scenario
You see two underscores or two underbars before a function in Python. What does this syntax signify?
Possible Solution #1
The answer is best explained by running this program once with no modification and a second time with a modification.
class ContintClass():
def __init__(self):
self.__completelyprivate = “1111111111”
self._semiprivate = “2222222”
foo = ContintClass()
#print(foo.__completelyprivate)
print(“Above is an attempt to print a completely private data member of an object”)
print(“Below is an attempt to print a semi-private data member of an object”)
print(foo._semiprivate)
Before you run the program the second time,
…
Continue reading “What Does “__” Mean in Python?”