# Buggy code
def __init__(self, load, ctx, name):
    """Boolean like object that lazily computes it boolean value when it is
    first asked. Once loaded, this result will replace itself
    in the provided context (typically the globals of the call site) with
    the given name.

    For example, you can prevent the complex boolean until it is actually
    used::

        ALIVE = LazyDict(lambda: not DEAD, globals(), 'ALIVE')

    Parameters
    ----------
    load : function with no arguments
        A loader function that performs the actual boolean evaluation.
    ctx : Mapping
        Context to replace the LazyAndSelfDestructiveDict instance in
        with the the fully loaded mapping.
    name : str
        Name in the context to give the loaded mapping. This *should*
        be the name on the LHS of the assignment.
    """
    self._load = load
    self._ctx = ctx
    self._name = name
    self._result = None


# Traceback (TypeError)
~⟫ xonsh
Traceback (most recent call last):
File "/usr/bin/xonsh", line 3, in <module>
main()
File "/usr/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 16446, in main
args = premain(argv)
File "/usr/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 16431, in premain
shell = builtins.__xonsh_shell__ = Shell(**shell_kwargs)
File "/usr/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 16185, in __init__
kwargs.get('cacheall', False))
File "/usr/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 16227, in _init_environ
debug_level=debug)
File "/usr/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 15871, in __init__
load_builtins(execer=self, config=config, login=login, ctx=xonsh_ctx)
File "/usr/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 15711, in load_builtins
builtins.__xonsh_env__ = ENV = Env(default_env(config=config, login=login))
File "/usr/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 11335, in __init__
self[key] = val
File "/usr/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 11468, in __setitem__
val = ensurer.convert(val)
File "/usr/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 6186, in to_history_tuple
return to_history_tuple((m.group(1), m.group(3)))
File "/usr/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 6189, in to_history_tuple
units, converter = HISTORY_UNITS[x[1]]
TypeError: 'LazyObject' object is not subscriptable
~⟫ xonfig
+------------------+----------+
| xonsh            | 0.4.2    |
| Python           | 3.5.1    |
| PLY              | 3.7      |
| have readline    | True     |
| prompt toolkit   | None     |
| shell type       | readline |
| pygments         | 2.1.3    |
| on posix         | True     |
| on linux         | True     |
| distro           | arch     |
| on darwin        | False    |
| on windows       | False    |
| on cygwin        | False    |
| is superuser     | False    |
| default encoding | utf-8    |
| git SHA          | None     |
+------------------+----------+
~⟫ $XONSH_HISTORY_SIZE
(10000, 'commands')

# Fixed code
def __init__(self, load, ctx, name):
    """Boolean like object that lazily computes it boolean value when it is
    first asked. Once loaded, this result will replace itself
    in the provided context (typically the globals of the call site) with
    the given name.

    For example, you can prevent the complex boolean until it is actually
    used::

        ALIVE = LazyDict(lambda: not DEAD, globals(), 'ALIVE')

    Parameters
    ----------
    load : function with no arguments
        A loader function that performs the actual boolean evaluation.
    ctx : Mapping
        Context to replace the LazyBool instance in
        with the the fully loaded mapping.
    name : str
        Name in the context to give the loaded mapping. This *should*
        be the name on the LHS of the assignment.
    """
    self._load = load
    self._ctx = ctx
    self._name = name
    self._result = None