Inheritance error in python 2.3.4???
Jack Diederich
jack at performancedrivers.com
Mon Feb 14 19:15:13 EST 2005
On Tue, Feb 15, 2005 at 10:56:23AM +1100, Delaney, Timothy C (Timothy) wrote:
> friedmud at gmail.com wrote:
>
> > I guess I could just use one underscore.... but that means it is
> > easier for other people to get at my implementation details (which,
> > coming from a C++ background really bothers me).
>
> This is the correct solution, and getting over being bothered about it
> is the correct thing to do.
>
> Getting at private members is simple in C++ too if anyone wants to do
> that.
As a long time C++ guy that switched over to python (via a perl detour) my
advice is to do things the python way even if they feel strange at first.
In this case forget about "private" and "protected." If it helps you can
consider them conventions that have some compiler support. The 20th
commandment of python is "we're all adults here." To see the first 19, type
"import this" at the python prompt.
I also discovered - to my shock and horror - that many of the GoF's "Design
Patterns" were actually C++ centric and not universals. The sting of seeing
canon reduced to a HOWTO fades quickly, just jump in with both feet.
-Jack
More information about the Python-list
mailing list