[IPython-user] Question about @run

Fernando Perez fperez at colorado.edu
Thu May 20 23:06:56 CDT 2004


Yann Le Du wrote:
> Hello,
> 
> I have a small program with a single function definition, the function is
> called func. If I run it using @run, modify the function definition using
> my editor, and use @run again to reflect the modifications, it works ok
> but the command func?? does not reflect the changes in the code.
> 
> I get the same problem using IPython 0.5 or 0.6. I'd like to know if that 
> behavior is to be expected, and if so, what other command should I be 
> using ?

Fixed in CVS, with a caveat: now you'll _always_ get the current file 
contents, regardless of whether you reload a module or not.  So:

run foo
foo.func?? -> shows current source
edit foo and change foo.func
foo.func?? -> shows changed source, even though the object in pyhton's memory 
is really still the old one (no new run foo has been issued).

Since it's really impossible to match objects in memory to actual source code 
other than through the filesystem, at least now all of ipython's mechanisms 
always show the current filesystem state.  This may not always be correct, but 
it's consistent, most likely correct in more cases than the previous 
situation, and I like it better :)

Thanks for reporting it.

Best,

f




More information about the IPython-user mailing list