[IPython-dev] Some ideas for more hooks

Fernando Perez Fernando.Perez at colorado.edu
Thu Mar 17 13:43:04 EST 2005

Frédéric Mantegazza wrote:
> (Fernando, you sent your answer both on my personnal address and on ipython 
> list, but I only received it from my address. Is it normal ? My mailer does 
> not remove any message, even if it is cross-posted...)

No, it's not normal.  I sent it to the list, so you should have gotten that.

>>>PS : PyMAD is a software we are developping to control spectrometers,
>>>big neutrons instruments.
>>Do you have a public page mentioning it?  I've made a little list of
>>links to projects which use ipython, I'd like to add yours.
> We do not have public page, but Ican make a little paper for you (I already 
> did for the Pyro project page).

That would be very nice.

>>>  New exception handler.
>>I need more specific details than this.
> I didn't post it, but I have a little piece of code to overload 
> IPython.iplib.InteractiveShell.runcode() method. In this method, I just 
> catch our PyMAD project exceptions, and print a message instead of the 
> traceback.
> I also catch a Pyro exception. I would like to be able here to get the code 
> which lead to the error, because I would like to make an automatic ribind 
> on the pyro object which as failed.

I need to see this example.  Would you mind completing the little draft you 
sent with this info and code examples?  I'd like to keep that whole document 
as a guide for the next few weeks worth of work, and it's much better if it's 
organized into a real document rather than scattered in pieces on an email thread.

>>>  Prevent objects from beeing deleted from global namespace.
>>What do you mean?  Do you want to block the 'del' operator?  Please give
>>me better details.  IPython's namespace handling is a bit delicate, so
>>this has to be done with care.
> Yes, I want to avoid the user to delete some our Pyro remote object proxies, 
> through the del operator. The idea is to give ipython a list of objects 
> which can't be deleted.
> But I understand it is not very easy to do. Let it at the bottom of your 
> todo list !

You could add a syntax prefilter yourself, which blocks on 'del foo' with an 
error message.  There is no way to prevent all avenues for deletion (exec can 
fool you), but this would cover most normal cases.  And you can do that today, 
with the existing machinery in ipython.  Look at the manual for examples of 
syntax prefilters.



More information about the IPython-dev mailing list