Skip to content

Instantly share code, notes, and snippets.

@wasprobot
Created May 24, 2018 19:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wasprobot/c339195f45c6c45d305cc667660e8641 to your computer and use it in GitHub Desktop.
Save wasprobot/c339195f45c6c45d305cc667660e8641 to your computer and use it in GitHub Desktop.
An easy substitute for 'switch-case..' in python
def mock_get_bins(self, key):
return {
BinHelper.ROUNDED_STAR: 'rounded-bin',
BinHelper.UNROUNDED_STAR: 'unrounded-bin',
BinHelper.TOTAL_REVENUE: 'revenue-bin',
BinHelper.QUALITY_BONUS: 'quality-bin',
}[key]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment