Skip to content

Instantly share code, notes, and snippets.

@hockeybuggy
Created April 30, 2015 13:33
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 hockeybuggy/ed848292df4f20f0a104 to your computer and use it in GitHub Desktop.
Save hockeybuggy/ed848292df4f20f0a104 to your computer and use it in GitHub Desktop.
class Test(object):
@property
def test1(self):
return potentially_expensive_call()
@property
def test2(self):
if not hasattr(self, "_test2"):
self._test2 = potentially_expensive_call()
return self._test2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment