Last active
July 7, 2019 14:33
-
-
Save icarovirtual/1116f11f5e7289923c31b1ae357a420f to your computer and use it in GitHub Desktop.
guard clauses: bad example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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