Last active
August 13, 2019 13:58
-
-
Save sloria/5895446 to your computer and use it in GitHub Desktop.
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
# Better | |
class Person: | |
def __init__(self, name, occupation): | |
self.name = name | |
self.occupation = occupation | |
self._relatives = None | |
@property | |
def relatives(self): | |
if self._relatives is None: | |
self._relatives = ... # Get all relatives | |
return self._relatives | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment