Re: caching an expensive property
Oleg Broytman <[email protected]> Wed, 10 Dec 2014 11:32:34 +0100
| Newsgroups | gmane.comp.python.sqlobject |
|---|---|
| Message-ID | <[email protected]> |
Hi! On Wed, Dec 10, 2014 at 12:33:03AM +0000, Daniel Monteiro Basso <[email protected]> wrote: > For recent Python versions (>2.7 I guess), you could have also written like: > with self.__cache_lock: > do_stuff > return self.__cache > The context protocol takes care of the rest. Yes, in 2.6+. > Cheers, > Daniel Oleg. -- Oleg Broytman http://phdru.name/ [email protected] Programmers don't die, they just GOSUB without RETURN. ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk