Inheritance error in python 2.3.4???

friedmud at gmail.com friedmud at gmail.com
Mon Feb 14 18:43:13 EST 2005


The problem is that I actually do need them to be private to the
outside world... but not to subclasses.  I guess what I actually need
is something like "protected" in C++.... but I don't think I'm going to
get that luxury.

I think what's happening in my example is that the name mangling is
looking at the defining class instead of looking at "self"... which is
not what I expected.  Which means it is accessing two different
variables (_subclass_something on the set and _baseclass__something on
the get)

Anyone know of a workaround for that?? (other than renaming the
variable so it doesn't have the two underscores?)

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).

Friedmud




More information about the Python-list mailing list