Understood, 
many thanks for the explanation.

Dietrich


Il giorno sabato 1 ottobre 2016 13:45:04 UTC+2, Almar Klein ha scritto:
>
> AFAIK the %edit command is supposed to run the contents of the file when 
> it is closed. In the way that it works with Pyzo, it seems to make IPython 
> think that the file is closed emmidiately, so it runs it at once.
>
>  
>
> Therefore, I’d suggest to not use this command, but use “open some_object“ 
> instead.
>
>  
>
> - Almar
>
>  
>
>  
>
>  
>
> *From: *Dietrich Pescoller <javascript:>
> *Sent: *29 September 2016 11:34
> *To: *Pyzo <javascript:>
> *Subject: *[Pyzo] Very strange/possibly dangerous behaviour of %edit
>
>  
>
> Hi,
>
> when I do 
> %edit of a module I have observed that it does not only open the file in 
> the editor but it also executes it.
>
> For instance if I have the following module:
> ==============================
> def myFun(): 
>
>     print('I was called')
>
>  
>
> if __name__ == '__main__':
>
>     myFun()
>
> ==============================
>
>
> and i call %edit i get:
>
>
> In [*5*]: %edit myFun
>
> Editing... done. Executing edited code...
>
> I was called
>
>  
>
>  
>
> So the module is not only opened but also executed!
> This should not be. 
>
>  
>
> Bye,
>
> dietrich
>
>  
>
>
>
>  
>
>  
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Pyzo" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to pyzo+uns...@googlegroups.com <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pyzo+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to