Why does python not have a mechanism for data hiding?

Russ P. Russ.Paielli at gmail.com
Thu Jun 5 20:39:55 CEST 2008


On Jun 5, 11:25 am, George Sakkis <george.sak... at gmail.com> wrote:
> On Jun 5, 2:07 pm, "Russ P." <Russ.Paie... at gmail.com> wrote:
>
> > The "private" keyword goes further and prevents
> > access even by derived classes. The double leading underscore in
> > Python does no such thing.
>
> Who develops these derived classes ? A competitor ? A malicious
> hacker ? A spammer ? Who are you trying to hide your precious classes
> from that the double leading underscore is not good enough
> protection ? Even with a 'private' keyword, what stops them from doing
> s/private/public/g ? Seriously, the "underscores are ugly" argument
> has some merit but language enforced data hiding is overrated, if not
> downright silly.

I did not claim that Python should have the same encapsulation rules
as C++. I was merely comparing the two in reply to a post that claimed
a similarity.



More information about the Python-list mailing list