Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Chain:
- def __init__(self, obj, root=None):
- self.__obj = obj
- def __getattr__(self, attr):
- val = getattr(self.__obj, attr)
- if callable(val):
- self.__callable = val
- return self
- return val
- def __call__(self, *args, **kw):
- val = self.__callable(*args, **kw)
- if val is None:
- return self
- return val
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement