[IPython-dev] getdoc hook

Fernando Perez Fernando.Perez at colorado.edu
Fri Apr 8 08:17:07 CDT 2005


Frédéric Mantegazza wrote:
> Le Vendredi 8 Avril 2005 11:24, Fernando Perez a écrit :

>>>2) Why is the getdoc() function always called, even when I don't use
>>>the 'obj?' syntax ?
>>
>>Because in the input evaluation loop, while I find what you typed (to
>>make auto-execution decisions and the like), once the object is found I
>>fish out in passing the docstring.  A lot of the machinery that does many
>>of the nice things in ipython needs to know quite a bit about the objects
>>referenced by names at the command line, so I tried to centralize this
>>collection of information in one place.  The actual routine is _ofind()
>>in Magic.py (that probably belongs somewhere else like iplib.py, really).
> 
> 
> So I will always have a call to the remote object getdoc() method (little 
> overhead)...

Well, let me see if I can clean that up a bit.  I really don't like the fact 
that _ofind() fishes out the docstring always, since quite often you don't 
really need it.  I may be able to change things so that getdoc() only gets 
called if the docstring is actually going to be used.  Stay tuned.

Best,

f




More information about the IPython-dev mailing list