class DemonstrateAccess( object ):
def __init__( self ):
self.value = 1
def __getattribute__( self, name ):
print "__getattribute__ executing..."
print "\tClient attempt to access attribute:", name
return object.__getattribute__( self, name )
def __getattr__( self, name ):
print "__getattr__ executing..."
print "\tClient attempt to access non-existent attribute:", name
raise AttributeError, "Object has no attribute %s" % name
|