Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def executor(_):
- def wrapper(self, *args, **kwargs):
- command = args[0]
- getattr(self, command)(*args[1:], **kwargs)
- return wrapper
- class Commands:
- @executor
- def do(self, *args, **kwargs):
- pass
- def svarit(self, count, sol=0):
- print('varim', count)
- print('sol', sol)
- def est(self, count, mayonaze=None):
- print('em', count)
- print('mayonaze', mayonaze)
- c = Commands()
- pipeline = [
- (('svarit', 5), {'sol': '2'}),
- (('est', 4), {'mayonaze': True})
- ]
- for action in pipeline:
- c.do(*action[0], **action[1])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement