Skip to content

Instantly share code, notes, and snippets.

@icarovirtual
Last active July 7, 2019 14:33
Show Gist options
  • Save icarovirtual/1116f11f5e7289923c31b1ae357a420f to your computer and use it in GitHub Desktop.
Save icarovirtual/1116f11f5e7289923c31b1ae357a420f to your computer and use it in GitHub Desktop.
guard clauses: bad example
# Sorry for the silly example
def is_platypus(self):
if self.is_mammal():
if self.has_fur():
if self.has_beak():
if self.has_tail():
if self.can_swim():
# It's a platypus!
return True
# Not a platypus
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment