[Python-Dev] Internal namespace proposal (original) (raw)

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Jul 28 02:51:43 CEST 2006


David Hopwood wrote:

Inheritance should be defined as though the code of inherited methods and attributes were copied into the subclass (with global accesses updated to point to the original module).

You'll have to propose an implementation strategy for that which works without actually copying all the code, though.

Since x.hidden is not accessible from attack.py, the attack fails.

But if _hidden were an attribute of the A instance that you were trying to protect, it would succeed. So you can't actually protect any direct attribute of a class that can be subclassed. Which means we're back to the situation of having to prevent access to class objects.

-- Greg



More information about the Python-Dev mailing list