Skip to content

Instantly share code, notes, and snippets.

@maheshgawali
maheshgawali / stateful_dispatcher.py
Created August 7, 2018 07:36
a stateful function dispatcher using simple python using chaining vs maintaining a dict
#!/usr/bin/env python3
# OBJECTIVE
# 1. script should be able to pick up from where it left off, assume that state is saved extrenally in some datastore
# 2. order of execution of methods matters
class statefulDispatcherUsingChaining():
def __init__(self, current_state=None):
self.current_state = "one" if not current_state else current_state