Skip to content

Instantly share code, notes, and snippets.

@ramalho
Last active August 29, 2015 14:00
Show Gist options
  • Select an option

  • Save ramalho/11179819 to your computer and use it in GitHub Desktop.

Select an option

Save ramalho/11179819 to your computer and use it in GitHub Desktop.
Value object for Pingo.io pin states
class State(object):
def __init__(self, value):
self.value = value
def __repr__(self):
return '%s(%r)' % (self.__class__.__name__, self.value)
def __str__(self):
return state.value
def __bool__(self):
return self.value == 'HIGH'
__int__ = __bool__
HIGH = PinState('HIGH')
LOW = PinState('LOW')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment