Will python never intend to support private, protected and public?

Steven D'Aprano steve at REMOVETHIScyber.com.au
Wed Sep 28 08:30:23 EDT 2005


For some reason, the original post never made it to my newsreader, so
apologies for breaking threading by replying to a reply when I mean to
answer the original post.

On Wed, 28 Sep 2005 12:05:21 +0100, Simon Brunning wrote:

> On 9/28/05, could ildg <could.net at gmail.com> wrote:

>> Python is wonderful except that it has no real private and protected
>> properties and methods.

Do you know any language that has real private and protected attributes?

There may be some. I don't know. But anyone who says "C++" is fooling
themselves:

#define private public

And your "real private and protected" objects are no longer private or
protected.



Simon wrote:

> If *real* private and protected are *enforced*, Python will be the
> poorer for it. See
> <http://groups.google.com/group/comp.lang.python/msg/b977ed1312e10b21>.

That's a wonderful, if long, essay. I don't think the author is wrong, but
I think his choice of terminology does Python a disservice (it is hard to
argue in favour of anarchy and chaos even to enlightened sensible
managers, let alone old dinosaurs and control-freaks).

It is too easy to mistakenly read that essay as saying that Python finds a
middle ground between two binary opposites of control and chaos. That's
not the case: chaos is a privative, not an actual thing. Chaos is what
you have when you have zero control. The question should be, how much
control a language needs: control is a continuous variable, not a binary
on/off state. Less control gives more flexibility. More control reduces
opportunities.

That's a minor quibble really, the essay is grand and should be read by
all developers.


-- 
Steven.




More information about the Python-list mailing list