Show More
@@ -1,18 +1,26 b'' | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | """ |
|
3 |
|
|
|
4 | To enable it type:: | |
|
3 | Provides a reload() function that acts recursively. | |
|
5 | 4 | |
|
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:: | |
|
8 | 11 | |
|
9 | You can then disable it with:: | |
|
12 | import __builtin__ | |
|
13 | from IPython.lib import deepreload | |
|
14 | __builtin__.reload = deepreload.reload | |
|
10 | 15 | |
|
11 | __builtin__.reload = deepreload.original_reload | |
|
16 | Or this for Python 3:: | |
|
12 | 17 | |
|
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 | |
|
14 | 21 | |
|
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. | |
|
16 | 24 | |
|
17 | 25 | This code is almost entirely based on knee.py, which is a Python |
|
18 | 26 | re-implementation of hierarchical module import. |
General Comments 0
You need to be logged in to leave comments.
Login now