Truly Private Variables in Python 3
Truly Private Variables in Python 3 Question: So I know the way to make a variable “private” in python like this: class Foo: def __init__(self): self.__private = ‘bar’ This “works” and doesn’t, as shown below: foo = Foo() ‘__private’ in vars(foo) #False ‘_Foo__private’ in vars(foo) #True Now, I understand this is the way to make …