Why does python not have a mechanism for data hiding?

John Salerno johnjsal at gmailNOSPAM.com
Sun Jun 8 22:44:40 EDT 2008


Sh4wn wrote:

> data hiding. I know member vars are private when you prefix them with
> 2 underscores, but I hate prefixing my vars, I'd rather add a keyword
> before it.

Others touched on this, but I thought I'd throw it in here as well since 
I was just reading about this. Apparently the double underscore 
convention has nothing to do with data hiding. It's simply a mechanism 
for avoiding name clashes, and data hiding only *seems* to be a result 
of it.

Not that that helps your situation any. :)



More information about the Python-list mailing list