Skip to content

Instantly share code, notes, and snippets.

@rec
Last active September 4, 2019 12:56
Show Gist options
  • Save rec/446645ebbb002875d3f59ccce4bde239 to your computer and use it in GitHub Desktop.
Save rec/446645ebbb002875d3f59ccce4bde239 to your computer and use it in GitHub Desktop.
dispatch.py
class Dispatch:
def monday(self): pass # Implementations here...
def tuesday(self): pass
def wednesday(self): pass
def thursday(self): pass
def friday(self): pass
def saturday(self): pass
def sunday(self): pass
dispatch = Dispatch()
now = datetime.datetime.now()
day = now.strftime('%A')
method = getattr(dispatch, day.lower())
method()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment