[IPython-user] Autoreload (Re: Food for thought on python and interactive work
Tue Jun 3 03:39:58 CDT 2008
ok thanks! (I know the usual way but having it readable together with
the reminder is a plus :) )
and I think that indeed Yosef Kreinin would pull his hair off his head
reading the caveats below : these are more or less exactly the reason
for his rant.
So it is probably a good canton to drill through as far as possible....
And one stupid question, which should probably be directed to another
list : why are attempts to fix the problem considered the job of 3rd
party software and not of python core?
Ville M. Vainio wrote:
> On Tue, Jun 3, 2008 at 11:18 AM, Johann Cohen-Tanugi
> <email@example.com> wrote:
>> well, can you actually add a description or a pointer, now that you opened
>> the Pandora's box in front of all "those that are not aware"
> Here is is (along with the usual way to find out about extensions) ;-):
> [c:/ipython]|10> import ipy_autoreload
> [c:/ipython]|11> ipy_autoreload?
> IPython extension: autoreload modules before executing the next line
> for documentation.
> [c:/ipython]|12> %autoreload?
> Type: Magic function
> Base Class: <type 'instancemethod'>
> String Form: <bound method InteractiveShell.autoreload_f of <IPython.iplib.In
> teractiveShell object at 0x00A40870>>
> Namespace: IPython internal
> File: c:\ipython\ipython\extensions\ipy_autoreload.py
> Definition: %autoreload(self, parameter_s='')
> %autoreload => Reload modules automatically
> Reload all modules (except thoses excluded by %aimport) automatically now.
> %autoreload 1
> Reload all modules imported with %aimport every time before executing
> the Python code typed.
> %autoreload 2
> Reload all modules (except thoses excluded by %aimport) every time
> before executing the Python code typed.
> Reloading Python modules in a reliable way is in general
> difficult, and unexpected things may occur. Some of the common
> caveats relevant for 'autoreload' are:
> - Modules are not reloaded in any specific order, and no dependency
> analysis is done. For example, modules with 'from xxx import foo'
> retain old versions of 'foo' when 'xxx' is autoreloaded.
> - Functions or objects imported from the autoreloaded module to
> the interactive namespace are not updated.
> - C extension modules cannot be reloaded, and so cannot be
More information about the IPython-user