private

James Kew james.kew at btinternet.com
Sat Jun 29 15:56:41 EDT 2002


"Peter Hansen" <peter at engcorp.com> wrote in message
news:3D1DE132.4A890D9D at engcorp.com...
> Rhymes wrote:
> >
> > Is there any possibility to build up a _real_ private attribute?
> > Such as C++ private data members...
>
> You realize that it's quite possible to get at private data members
> in C++, don't you?

I can't help feeling this is overly dismissive!

Yes, of course one can circumvent private in C++. But for me the main value
of the public and private specifiers is that they _document_ to the client
of the class what it should access and what it should not.

I don't -- in my admittedly very limited experience -- find Python classes
as immediately self-documenting. It's not obvious from the class definition
what is intended to be called or modfied by the client and what is internal
to the implementation.

I suspect I'm still in the crossover period from strictly declarative C/C++
and the "anything goes" Pythonic way and that, given time, I'll find my
groove and feel comfortable.

> This has been discussed about 479 times in the last decade.

I'll bet. I'll shut up about it now.

James






More information about the Python-list mailing list