Why does python not have a mechanism for data hiding?

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Tue Jun 10 10:04:10 CEST 2008


Russ P. a écrit :
> On Jun 9, 2:10 pm, "bruno.desthuilli... at gmail.com"
> <bruno.desthuilli... at gmail.com> wrote:
> 
>> But if it takes 6 month to get the mentioned developer to release
>> something I can use, I'm screwed up. Fine.
> 
> I've lost track of how many times I've said this now, but my
> suggestion for a "priv" keyword allowed for "indirect" access to
> private data through some name-mangling scheme. 

And I've lost track of how many times I've said this now, but we already 
have this. While we're at it, why not a 'prot' keyword that would 
restrict name-mangling to the addition of a single leading underscore ?

> That could be your
> temporary fix while you are waiting for the developer to release a
> corrected version. And even if that option were not available, you
> could simply open up the relevant source file in the editor of your
> choice and remove the offending "priv" declaration.

Yes. And I can always edit the source code and add the methods I need 
etc. You probably never used monkeypatching, so I guess you just can't 
understand the difference between maintaining a monkeypatch and 
maintaining a fork.

> I completely fail
> to see how you are "screwed."

> Sorry, but when I have to keep repeating the same basic points over
> and over, I can't help but think I might be wasting my time.

If you hope to get a general agreement here in favor of a useless 
keyword that don't bring anything to the language, then yes, I'm afraid 
you're wasting your time.




More information about the Python-list mailing list