[IPython-dev] Extension loading

Zoltán Vörös zvoros at gmail.com
Sat Sep 29 12:03:17 EDT 2012

On 09/29/2012 05:42 PM, Thomas Kluyver wrote:
> So, I see three options:
> 1. The extension manager doesn't track what's loaded, and it remains
> up to the extension to avoid loading twice if it wants to.*
> 2. The extension manager tracks what's loaded, and refuses to load
> anything more than once. It's up to the user to call %reload_ext if
> they need to reload something.
> 3. The extension manager tracks what's loaded, and calling %load_ext a
> second time works like %reload_ext (optional: get rid of %reload_ext,
> which has become redundant)
What about adding the flag '-f' to %load_ext, which would reload the 
extension no matter what, and without the flag, if the extension is 
already loaded, the user would just get a warning, but the extension 
wouldn't be reloaded? By using the flag explicitly, accidents can be 
prevented (e.g., in the notebook, the user calls %load_ext, and nothing 
happens, because the extension is already loaded, and then the user 
moves 3 cells down, forgets about the previous call, and calls %load_ext 
again), and you wouldn't have to keep track of how many times you called 
%load_ext. I think "overloading" the magic function in the way you 
suggested could result in some unexpected/undesired behaviour.


More information about the IPython-dev mailing list