Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

Caches a result, and returns it. Useful in if statements.

Project description

In python it is not possible to do this:
if temp=do_something() == 42:

And storing it before is not an option?
(you have something very resources-expensive, or changing values)

temp = do_something()
temp2 = do_something_else()
if temp == 42:
elif temp2:

Somebody need to hold that result for you:

h = Holder()
if h(do_something()) == 42:
elif h(do_something_else()):

Project details

Release history Release notifications

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page