Why does python not have a mechanism for data hiding?

bruno.desthuilliers at gmail.com bruno.desthuilliers at gmail.com
Mon Jun 9 23:10:11 CEST 2008

On 9 juin, 20:43, "Russ P." <Russ.Paie... at gmail.com> wrote:

(snip argument about s/private/public/g on a whole source tree not
being a fork, and not being by far a worse hack than monkeypatching a
small specific part of a whole lib - what can I say ?)

> How about some common sense here.

Good question.

But for which definition of "common sense" ? May I remind you that,
for a long time, "common sense" dictated that the earth was flat and
at the center of the universe, and that anything heavier than air
could by no mean fly ? Or, more recently,  that their was a market for
at most 5 computers on earth, and that 640kb of RAM ought to be enough
for anyone ?

> If you, the client, are convinced
> that something declared private should really be public, then perhaps
> you should contact the developer and explain your reasoning.

Indeed.  At least something we seem to agree on.

> If the
> developer agrees, then the problem is solved.

Indeed again. But...

But if it takes 6 month to get the mentioned developer to release
something I can use, I'm screwed up. Fine.

As strange as it might be, I prefer to *first* make it work, *then*
contact the developer. And while we're at it:

> If not,

Then I prefer to be able to monkeypatch the code and only maintain my
monkeypatch than to have to maintain a whole fork of the original

But YMMV of course...

>  then perhaps it
> is *you*, the client who does not understand the proper usage of the
> code.

Do you really think that I'm fiddling with implementation stuff that
may break my code any other release because I don't *understand* that
code ? But anyway : even if it happened to be the case, it would still
be my own responsability. So what's the matter ? Should we forbid
hammers because you could use one to bang your head with ?

> I don't have time to reply to all or your claims, but my lack of a
> reply to any particular point should not be construed as implicit
> agreement.

Sounds like a lawyer's notice. Anyway, your lack of agreement won't
keep me from happily add implentation attributes to existing objects
whenever I find it appropriate. Sorry for being more on the pragmatic
side than on the cargo-cult one.

More information about the Python-list mailing list