refresing the edited python function

Jean-Michel Pichavant jeanmichel at sequans.com
Tue Aug 20 12:37:37 EDT 2013


----- Original Message ----- 

> Hi,
> I have been using ipython and ipython with qtconsole and working on a
> code with functions. Each time I make a modification in function

> I have to quit IPTHON console (in both with and with out qt console )
> and reload the function freshly. If I need to see the changed I made
> in the function. I tried below options
> del function name

> import the module again by issuing "from xxx.py import yy"
> import xxx.py
> make changes
> reload(xxx.py)
> this works only if the the function in the code has same name as the
> code. But even this do not reflect the changes made by editing the
> code.
> So what is the standard way to update the function for further tests
> after an edit?
> with best regards,
> Sudheer

Hi,

My "standard" way ;) :
1/ create a file
2/ edit the code
3/ run ipython (with %pdb on)
4/ within ipython "run myfile.py"
5/ check / introspect /debug
6/ change the code
7/ exit ipython
8/ reenter ipython
9/ using the ipython shell history, reexecute the file (2 key press) and go back to 5/

I used to reload my objects, it's been useful until one time when I lost a lot of time because of some nasty side effect. In the end it's not worth it. Always quit the shell, always.

JM



-- IMPORTANT NOTICE: 

The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


More information about the Python-list mailing list