Skip to content

Commit

Permalink
Merge pull request ipython#5335 from takluyver/deepreload-docstrign
Browse files Browse the repository at this point in the history
Update docstring for deepreload module
  • Loading branch information
minrk committed Mar 13, 2014
2 parents 0122784 + 4c76bcb commit d223a06
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions IPython/lib/deepreload.py
Original file line number Diff line number Diff line change
@@ -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.
Expand Down

0 comments on commit d223a06

Please sign in to comment.