formations/python/python2/formation/snippets/wrap.py
2018-08-21 10:26:27 +02:00

23 lines
583 B
Python

class Wrap(object):
def __init__(self, name, wrap):
self.slots = ('_name', '_w')
self._name = name or "wrapped_element"
self._w = wrap
def __getattr__(self, name):
if name in self.slots:
return getattr(self, name)
else:
return getattr(self._w, name)
# def get_w(self, name):
# return getattr(self._w, name)
# def set_w(self, name, value):
# return setattr(self._w, name, value)
# _w = property (get_w, set_w)
def __repr__(self):
return "[W_Element %s]"% repr(self._name)