Skip to content

Instantly share code, notes, and snippets.

@sloria
Last active December 19, 2015 04:18
Show Gist options
  • Save sloria/5895673 to your computer and use it in GitHub Desktop.
Save sloria/5895673 to your computer and use it in GitHub Desktop.
# Better
class Boiler:
def safety_check(self):
if any([self.temperature > MAX_TEMPERATURE,
self.pressure > MAX_PRESSURE]):
if not self.shutdown():
self.alarm()
def alarm(self):
with open(BUZZER_MP3_FILE) as f:
play_sound(f.read())
@property
def pressure(self):
pressure_psi = abb_f100.register / F100_FACTOR
return psi_to_pascal(pressure_psi)
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment