class File(object): def __init__(self, filename): if os.path.isfile(filename): self.filename = filename self.file = open(filename
Prefixing an attribute with double underscores doesn't make the attribute private, it simply makes polymorphism impossible because the attribute name gets mangled with the current class name. Change it to a single underscore prefix instead.