Protected Methods and Python
Mads Orbesen Troest
mads at troest.NEVERMORE.dk
Sun Apr 13 15:26:37 EDT 2003
On Sun, 13 Apr 2003 21:24:24 +0200, Mads Orbesen Troest wrote:
>> Or may be it is possible to emulated Protected Methods in Python.
>
> It can be "emulated" by prepending the method/attribute name with 2
> underscores.
Whoops, I was too quick and didn't see that you wrote "protected" and not
"private".
At any rate: the mangling scheme can be used for "protected" methods, since
you know the mangled name is _classname__attribute/method. You can then be
one of the "evil" persons I talked about in the previous post, and access
the "private" member that way.
/\/\\ads Orbesen Troest
More information about the Python-list
mailing list