Examples
Forward all unimplemented methods to a file:
from grizzled.forwarder import Forwarder
class MyFileWrapper(Forwarder):
def __init__(self, file):
Forwarder.__init__(self, file)
w = MyFileWrapper(open('/tmp/foo'))
for line in w.readlines():
print line
Forward all unimplemented calls, except name, to the specified
object. Calls to name will raise an AttributeError:
from grizzled.forwarder import Forwarder
class MyFileWrapper(Forwarder):
def __init__(self, file):
Forwarder.__init__(self, file, 'name')
|
|
__init__(self,
wrapped,
*exceptions)
Initialize a new Forwarder that will pass unimplemented calls
(method calls, attribute accesses, etc.) to the specified object. |
source code
|
|
|
|
|
|
Inherited from object:
__delattr__,
__format__,
__getattribute__,
__hash__,
__new__,
__reduce__,
__reduce_ex__,
__repr__,
__setattr__,
__sizeof__,
__str__,
__subclasshook__
|