On 2008-01-18, citizen Zbigniew Braniecki testified:
> It's really a nice pitfall, I can hardly imagine anyone expecting this, 

AFAIR, it's described in Diving Into Python.
It's quiet elegant way of creating cache.

def calculate(x,_cache={}):
        try:
                return _cache[x]
        except KeyError:
                _cache[x] = result = _lotsa_slow_calculations(x)
                return result

bart
-- 
            This signature is intentionally left blank.
http://candajon.azorragarse.info/ http://azorragarse.candajon.info/
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to