Skip to content

Instantly share code, notes, and snippets.

View animationdavid's full-sized avatar

David Bastidas animationdavid

View GitHub Profile
@animationdavid
animationdavid / switcher.py
Created March 20, 2021 10:50
Python Switcher
class Switcher(object):
def numbers_of_options(self, argument):
"""Dispatch method"""
method_name = 'option_' + str(argument)
method = getattr(self, method_name, lambda: "Invalid option")
return method()
def option_1(self):
return "My option 1"