Re: Online Modification of Python Code

2005-09-06 Thread malv
Your algoreload() is of the hand of a master. I'll give it a try. Thank you Bengt! -- http://mail.python.org/mailman/listinfo/python-list

Re: Online Modification of Python Code

2005-09-05 Thread Robert Kern
Bengt Richter wrote: > What about something on the pattern of (untested!) > > import algomodule # first time > > def algoreload(): > algosource = algomodule.__file__.replace('.pyc','py') > algomodule.__dict__.clear() > try: > execfile(algosource, algomodule.

Re: Online Modification of Python Code

2005-09-05 Thread Bengt Richter
On Mon, 05 Sep 2005 11:53:09 +0200, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> >> I seem to recall a post by Diez Roggish that reload() doesn't always >> work as it should. Any news on this? At least im my preliminary test it >> works. > >Read the docs on reload: > >http://www.python.org/d

Re: Online Modification of Python Code

2005-09-05 Thread Lisandro Dalcin
can you send a small example of thing you are trying to do? As Python is *really* dynamic, you can adapt algorithms in many ways... in general, you can change methods, or even class! of almost any object... -- http://mail.python.org/mailman/listinfo/python-list

Re: Online Modification of Python Code

2005-09-05 Thread malv
Diez, You are quite right on using module.name when importing module objects. This happened to be the way I ran my initial successful tests. Later I modified things by using 'import * from algotest' and my modifications stopped from coming through. In my case reload comes in very handy. I can see

Re: Online Modification of Python Code

2005-09-05 Thread Diez B. Roggisch
> > I seem to recall a post by Diez Roggish that reload() doesn't always > work as it should. Any news on this? At least im my preliminary test it > works. Read the docs on reload: http://www.python.org/doc/current/lib/built-in-funcs.html """ If a module is syntactically correct but its initia

Re: Online Modification of Python Code

2005-09-05 Thread malv
Hi Robert: (1) Things are not that simple. In fact in setting up a run, extensive database backup is already involved. Subsequently, data structures are built at runtime of typically 0.5Gbytes. Although saving this should work, it would require quite some debug/verification to check out the validit

Re: Online Modification of Python Code

2005-09-05 Thread malv
I wrote a module testalgo.py with some functions to be modified. After modification I typed to the interactive shell: >>>import testalgo >>>reload(testalgo) ... and things seem to workout as you suggested. At least I modified some quickie print statements to check. I use eric3 and nothing in this I