Last active
December 19, 2015 04:09
-
-
Save sloria/5895397 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
# The slow way | |
class Person: | |
def __init__(self, name, occupation): | |
self.name = name | |
self.occupation = occupation | |
self.relatives = self._get_all_relatives() | |
def _get_all_relatives(): | |
... | |
# This is an expensive operation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment