Skip to content

Instantly share code, notes, and snippets.

@sloria
Last active December 19, 2015 04:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sloria/5895397 to your computer and use it in GitHub Desktop.
Save sloria/5895397 to your computer and use it in GitHub Desktop.
# 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