Private attributes / Methods in Python
ameoba
ahmebah at hotmail.com
Thu Jan 17 04:56:32 EST 2002
Henry <henry at nospam.com> wrote in
news:uzJ08.19095$WQ1.2956322 at news6-win.server.ntlworld.com:
> But I don't fully under the "class VirtualAttribute" example, because I
> can still do
>
> a = VirtualAttribute()
> a.__setattr__("name","theValue")
There's always going to be a way to work arround things. The idea is that
there's a convention that says "Don't touch this stuff". Variable
protection is supposed to help you avoid accidentally touching something
you shouldn't. If you are determined to do the Wrong Thing, protected
variables aren't going to make your code good.
More information about the Python-list
mailing list