Why does python not have a mechanism for data hiding?

sturlamolden sturlamolden at yahoo.no
Tue Jun 3 19:54:14 CEST 2008

On May 24, 3:41 pm, Sh4wn <luckyluk... at gmail.com> wrote:

> first, python is one of my fav languages, and i'll definitely keep
> developing with it. But, there's 1 one thing what I -really- miss:
> 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.

Python has no data hiding because C++ has (void *).

Python underscores does some name mangling, but does not attempt any
data hiding.

Python and C has about the same approach to data hiding. It is well
tried, and works equally well in both languages:

   # this is mine, keep your filthy paws off!!!

Irresponsible programmers should not be allowed near a computer
anyway. If you use data hiding to protect your code from yourself,
what you really need is some time off to reconsider your career.

More information about the Python-list mailing list