Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #52679
| References | <1376873736.85790.YahooMailNeo@web193402.mail.sg3.yahoo.com> <87haemjj92.fsf@handshake.de> |
|---|---|
| Date | 2013-08-19 15:27 +0800 |
| From | Sudheer Joseph <sudheer.joseph@yahoo.com> |
| Subject | Re: refresing the edited python function |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.18.1376901579.19984.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
Thank you Dieter, I never thought it will be so difficult task, All I was thinking was that, I just do not know how it is done. I wonder how the code developers work in this case every time a function is modified one has to restart the console is a nightmare... Hope one day some solution will be evolved. with best regards, Sudheer >________________________________ > From: dieter <dieter@handshake.de> >To: python-list@python.org >Sent: Monday, 19 August 2013 11:48 AM >Subject: Re: refresing the edited python function > > >Sudheer Joseph <sudheer.joseph@yahoo.com> writes: > >> 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? > >Getting changes into a running application is difficult. >Python has not been designed to make this easy. > >The "reload" above is one partial way to achieve something like this. >The "reload" causes the module to be reloaded. If you have changed >the modules code, these changes will be reflected *inside* the reloaded >module. However, other modules may have imported objects from >this module (as in your "from xxx.py import yy"). To see changes >in those objects, they, too, must repeat the import (otherwise, >they continue to use the old, unchanged object). > >There is an additional approach, used e.g. by "plone.reload". >In this approach, the objects are modified "in place". All usage >points of the modified object will see changes. >However, there are (quite severe) limitations to what changes >can be made "in place". Thus, this, too, does not give a complete >solution. > >In simple cases, one of those approaches can avoid a restart >after modifications. However, in general, a restart is required. > >-- >http://mail.python.org/mailman/listinfo/python-list > >
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: refresing the edited python function Sudheer Joseph <sudheer.joseph@yahoo.com> - 2013-08-19 15:27 +0800
csiph-web