Created
March 16, 2016 05:50
-
-
Save jbbarth/6a8c72b987feca15f837 to your computer and use it in GitHub Desktop.
Blog post test
This file contains hidden or 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
def notify(msg): | |
print "NOTIFY: {}".format(msg) | |
def process(): | |
#... | |
notify = False | |
if notify: | |
# take action | |
print "processing!" | |
#... |
This file contains hidden or 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
def expensive(foo): | |
if not hasattr(expensive, "_cached"): | |
expensive._cached = process_expensive_computation() | |
return epensive._cached |
This file contains hidden or 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
def expensive() | |
@expensive ||= process_expensive_computation() | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment