def dhook_wrap(func,*a,**k):

    def f(*a,**k):

        dhook_s = sys.displayhook
        sys.displayhook = sys.__displayhook__
        try:
            out = func(*a,**k)
        finally:
            sys.displayhook = dhook_s

        return out

    f.__doc__ = func.__doc__
    return f
Wrap a function call in a sys.displayhook controller.
dataset/ETHPy150Open ipython/ipython-py3k/IPython/utils/doctestreload.py/dhook_wrap