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

R. Bernstein rocky at panix.com
Thu Oct 12 07:21:34 CDT 2006


Ville M. Vainio writes:
 > On 10/12/06, R. Bernstein <rocky at panix.com> wrote:
 > 
 > >     def do_pinfo(self, arg):
 > >         """The debugger (or any application) equivalant of ?obj"""
 > >         namespaces = [('Locals', self.curframe.f_locals),
 > >                       ('Globals', self.curframe.f_globals)]
 > 
 > Any particular reasons for using tuple for namespaces instead of
 > separate kwargs?

It occured to me that you might be asking why namespaces is this funny
list of tuples. If that's what you mean, it's because that's the
structure currently used in Magic._ofind.

When I first read that code I thought it odd. Personally I think
_ofind should be rewritten using a simple dictionary, e.g:

      namespaces = { 'Interactive': self.shell.user_ns, ... }
rather than 
      namespaces = [ ('Interactive', self.shell.user_ns), ... ]

I didn't do this initially because, well, I'm currently backed up in
patches, what I have works and I don't want to destroy that, and
adding my own version control on top of SVN checked-out sources is a
bit whacky.

Which reminds me, in _ofind, any particular reasons why 1 and 0 are
used for is_alias (and other seemingly boolean variables) rather than
True/False? ;-)


More information about the IPython-dev mailing list