[IPython-dev] making pdoc, pdef, and pinfo more generally useful (Was Re: Patches to use pydb instead of pdb for debugging)

Ville M. Vainio vivainio at gmail.com
Thu Oct 12 11:23:22 EDT 2006

On 10/12/06, R. Bernstein <rocky at panix.com> wrote:

> Although I don't like talking to myself, since no one else has said
> anything on this topic, I've been ploughing on and here's what I've
> found.

Yeah, a lot has been happening this last week (some of which I am only
able to speak properly next week, but might involve much more python
coding in my day job) and I haven't tested pydb yet. Sorry :-).

> In order to make the object inspection routines more useful to an
> application (like a debugger) which is run from ipython, in a test
> version I've changed Magic._ofind to accept a namespace parameter.
> The default is the current hard-coded list. Routines like _inspect,
> pdoc, pdef, and pinfo have been modified to allow this optional
> parameter. Having done this, the debugger routine becomes
>     def do_pinfo(self, arg):
>         """The debugger (or any application) equivalant of ?obj"""
>         namespaces = [('Locals', self.curframe.f_locals),
>                       ('Globals', self.curframe.f_globals)]
>         __IPYTHON__.magic_pinfo("pinfo %s" % arg, namespaces=namespaces)
> and similarly for do_pdef, and do_pdoc. Overall, pretty simple.
> Personally, I think a better organization though would be to pull out
> the object inspection routines and make them their own class. The fact
> that they are glommed with other routines like magic_lsmagic or
> magic_autocall are just artifacts the current ipython interface naming
> convention.

They are in the wrong place, yes, but such refactoring may not be
optimal for the "stable" branch. Instead, I'd like to see your patches
for kludging the _ofind, _inspect et. al. with optional 'namespaces'
keyword argument. I have no opposition to getting them in.

So send out patches for whatever you've got in your working copy
(preferably by friday) and I'll take a proper look at them.

Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'

More information about the IPython-dev mailing list