Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4986e3d

Browse files
committed
Update docstring for deepreload module
1 parent 9aa711b commit 4986e3d

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

IPython/lib/deepreload.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
11
# -*- coding: utf-8 -*-
22
"""
3-
A module to change reload() so that it acts recursively.
4-
To enable it type::
3+
Provides a reload() function that acts recursively.
54
6-
import __builtin__, deepreload
7-
__builtin__.reload = deepreload.reload
5+
Python's normal :func:`python:reload` function only reloads the module that it's
6+
passed. The :func:`reload` function in this module also reloads everything
7+
imported from that module, which is useful when you're changing files deep
8+
inside a package.
9+
10+
To use this as your default reload function, type this for Python 2::
811
9-
You can then disable it with::
12+
import __builtin__
13+
from IPython.lib import deepreload
14+
__builtin__.reload = deepreload.reload
1015
11-
__builtin__.reload = deepreload.original_reload
16+
Or this for Python 3::
1217
13-
Alternatively, you can add a dreload builtin alongside normal reload with::
18+
import builtins
19+
from IPython.lib import deepreload
20+
builtins.reload = deepreload.reload
1421
15-
__builtin__.dreload = deepreload.reload
22+
A reference to the original :func:`python:reload` is stored in this module as
23+
:data:`original_reload`, so you can restore it later.
1624
1725
This code is almost entirely based on knee.py, which is a Python
1826
re-implementation of hierarchical module import.

0 commit comments

Comments
 (0)