Why does python not have a mechanism for data hiding?

Ville Vainio vivainio at gmail.com
Mon May 26 05:25:53 EDT 2008


On May 26, 7:49 am, "Russ P." <Russ.Paie... at gmail.com> wrote:

> I may be full of beans here, but I would like to make a suggestion.
> Why not add a keyword such as "private," and let it be the equivalent
> of "protected" in C++? That would make member variables and functions

Better yet, have '@@foo' be translated to self.__foo. It would cut
some whining about 'self' as well, which would probably make it a more
worthwhile change (private attributes is a feature I don't really care
about much).

Obviously nobody should hold their breath and wait for this to happen.
This is a problem that needs to be solved on API doc generation / IDE
autocompleter layer. If everybody agreed on how to tag published vs.
private methods in docstrings or wherever, we would be mostly set.



More information about the Python-list mailing list