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

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Jul 27 09:14:27 CEST 2006


David Hopwood wrote:

A restricted interpreter refuses access to any object attribute or method with a name beginning with '' (by throwing a new exception type 'InternalAccessException'), unless the access is from a method and its static target is that method's first argument variable.

What's to stop

def my_naughty_method(self): self = some_protected_object self._a_special_attribute = some_naughty_value

init is an internal method. This is as it should be, because it should not be possible to call init on an existing object; only to have init implicitly called when a new object is constructed.

What about calling an inherited init method? Your proposed rule would seem to disallow

BaseClass.init(self, ...)

-- Greg



More information about the Python-Dev mailing list