[IPython-user] bug in edit magic: content of edited file is not accessible

Alexander Belchenko bialix at ukr.net
Thu Jan 12 10:14:39 CST 2006

Fernando Perez пишет:
> Alexander Belchenko wrote:
>>In 0.6.15 when I edit file with edit magic command I've got content of 
>>edited file in last Out variable. In 0.7.0 this is broken: after editing 
>>code was executed but text is not accessible as _X variable. Is this 
>>intended behaviour? I think it's a bug.
> Well, I deliberately removed that return statement, because I was finding it 
> annoying to get all that output, just after I'd been editing the file anyways. 
>   If you could clarify your usage case for needing that info back as a 
> variable, I can come up with a decent solution for the various cases.

My use case:

- Using edit for handy editing of chunks of experimental python code in 
external editor (with syntax coloring)
- After each edit IPython execute my code and I debug it on-the-fly
- When I have errors in my chunk I need re-edit this chunk
- But sometimes I want to return not to previous edited code but more 
earlier. Because last edit may introduce more errors (syntax or logical) 
then I expect. In this case is better to return to more stable point.
- So I need to easy re-edit not only last edited chunk

I'm OK if text of last edited file will not showed on the screen in 
IPython session. But at least I'd like to have possibility to have 
access to previously edited code as _X variable. As it was before. It's 
very handy.


More information about the IPython-user mailing list