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