Project

General

Profile

1
# Proxy object
2

    
3
class Proxy:
4
    '''A proxy that forwards all accesses to an inner object.
5
    Note that it does not forward attribute assignments.
6
    '''
7
    
8
    def __init__(self, inner): self.inner = inner
9
    
10
    def __getattr__(self, attr): return getattr(self.inner, attr)
11
    
12
    # Don't override __setattr__() because it prevents the subclass from storing
13
    # its own instance variables using "self." syntax
(3-3/35)