Take the tour ×  I'm using an API from a different site that
returns a couple of 'pricepoint URL's that my users use to buy
Virtual Goods.  I'm supposed to cache those results for at least
an hour, since they don't change the price points on their
system much. (And we want to save both our's and their
bandwidth.)  After looking for singleton's in Python I
discovered the borg pattern, which seems even cooler, so this is
what i did:  def fetchPrices():     #uses urllib2.urlopen() to
fetch prices     #parses results with ElementTree     return
prices  class PriceStore():     __shared_state = {}      def
update(self):         if self.lastUpdate is not None and
(datetime.now() - self.lastUpdate).seconds >= 3600:
self.prices = fetchPrices()             self.lastUpdate =
datetime.now()         elif self.lastUpdate is not None:
self.lastUpdate = datetime.now() - timedelta(hours=1)      def
__init__(self):         self.__dict__ = self.__shared_state
self.lastUpdate = None  The idea is t