# :coding: utf-8
# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips
# :license: See LICENSE.txt.

from .base import Logger


class Dynamic(Logger):
    '''Dynamic logger allowing delayed computation of values.'''

    def __getitem__(self, key):
        '''Return value referenced by *key*.

        If the value is a callable, then call it and return the result. In
        addition store the computed result for future use.

        '''
        value = self._mapping[key]
        if callable(value):
            self[key] = value = value()

        return value

@@ -98,16 +98,36 @@
 E.txt.%0A%0A
+import collections%0A%0A
 from .ba
@@ -509,21 +509,45 @@
  if 
-callable(valu
+isinstance(value, collections.Callabl
 e):%0A

Use collections.Callable test for future compatibility.