ya2 · news · projects · code · about

first commit
[pmachines.git] / lib / facade.py
1 # class Facade(object):
2
3 # # def _fwd_mth(self, mth_name, tgt_mth):
4 # # def fun(*args, **kwargs): return tgt_mth(*args, **kwargs)
5 # # setattr(self, mth_name, fun)
6
7 # # def _fwd_prop(self, prop_name, tgt_prop):
8 # # setattr(self.__class__, prop_name, property(lambda self: tgt_prop))
9
10 # def __init__(self, prop_lst=[], mth_lst=[]):
11 # list(map(lambda args: self.__fwd_prop(*args), prop_lst))
12 # list(map(lambda args: self.__fwd_mth(*args), mth_lst))
13 # # try detecting if the forwarded item is a prop or a method, so we
14 # # can pass only a single list
15
16 # def __fwd_mth(self, mth_name, tgt_mth):
17 # def fun(*args, **kwargs): return tgt_mth(self)(*args, **kwargs)
18 # setattr(self, mth_name, fun)
19
20 # def __fwd_prop(self, prop_name, tgt_prop):
21 # setattr(self.__class__, prop_name, property(tgt_prop))
22
23 # def destroy(self): pass