From 4986e3de1700c43c04900eeee08c655aabed4a38 2014-03-12 18:28:23 From: Thomas Kluyver Date: 2014-03-12 18:28:23 Subject: [PATCH] Update docstring for deepreload module --- diff --git a/IPython/lib/deepreload.py b/IPython/lib/deepreload.py index 69c5f7a..7da92c7 100644 --- a/IPython/lib/deepreload.py +++ b/IPython/lib/deepreload.py @@ -1,18 +1,26 @@ # -*- coding: utf-8 -*- """ -A module to change reload() so that it acts recursively. -To enable it type:: +Provides a reload() function that acts recursively. - import __builtin__, deepreload - __builtin__.reload = deepreload.reload +Python's normal :func:`python:reload` function only reloads the module that it's +passed. The :func:`reload` function in this module also reloads everything +imported from that module, which is useful when you're changing files deep +inside a package. + +To use this as your default reload function, type this for Python 2:: -You can then disable it with:: + import __builtin__ + from IPython.lib import deepreload + __builtin__.reload = deepreload.reload - __builtin__.reload = deepreload.original_reload +Or this for Python 3:: -Alternatively, you can add a dreload builtin alongside normal reload with:: + import builtins + from IPython.lib import deepreload + builtins.reload = deepreload.reload - __builtin__.dreload = deepreload.reload +A reference to the original :func:`python:reload` is stored in this module as +:data:`original_reload`, so you can restore it later. This code is almost entirely based on knee.py, which is a Python re-implementation of hierarchical module import.