Created
April 30, 2015 13:33
-
-
Save hockeybuggy/ed848292df4f20f0a104 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
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