[IPython-dev] Reloading compiled modules in a notebook

Brian Granger ellisonbg at gmail.com
Wed Mar 19 23:03:51 EDT 2014


Have a look at the Cython magic, we do this type of thing there. The
basic idea is that we build each version with a uuid so each version
is a completely separate extension module.

https://github.com/ipython/ipython/blob/master/IPython/extensions/cythonmagic.py

Cheers,

Brian

On Wed, Mar 19, 2014 at 5:00 AM, Robert Kern <robert.kern at gmail.com> wrote:
> On 2014-03-19 11:26, Tiago Antao wrote:
>> On Wed, 19 Mar 2014 12:16:45 +0100
>> Austin Bingham <austin.bingham at gmail.com> wrote:
>>
>>> Ah, it appears you're right. I should have checked this first. Thanks
>>> for helping me sort this out.
>>
>> I think Python 3 allows you to reload modules:
>
> Not extension modules.
>
>> http://docs.python.org/3/library/imp.html#imp.reload
>>
>> and, since 3.4
>>
>> http://docs.python.org/3/library/importlib.html#importlib.reload
>
> "The init function of extension modules is not called a second time."
>
> "In many cases, however, extension modules are not designed to be initialized
> more than once, and may fail in arbitrary ways when reloaded."
>
>> Of course 2 might be a completely different affair...
>
> It's exactly the same, except for where the reload() function is found:
>
> http://docs.python.org/2/library/functions.html#reload
>
> --
> Robert Kern
>
> "I have come to believe that the whole world is an enigma, a harmless enigma
>   that is made terrible by our own mad attempt to interpret it as though it had
>   an underlying truth."
>    -- Umberto Eco
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev



-- 
Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger at calpoly.edu and ellisonbg at gmail.com



More information about the IPython-dev mailing list