python debugger tips?
Bruno Desthuilliers
bdesth.quelquechose at free.quelquepart.fr
Sat Oct 11 09:21:04 EDT 2008
just.another.random.user at gmail.com a écrit :
> Hi All,
>
> I'm switching to python from perl, and like the language a ton, but I
> find pdb and pydb to be vastly inferior debuggers to the perl version.
>
> In particular, I've grown very used to stepping into arbitrary
> functions interactively. For instance, in perl you can do this:
>
> casqa1:~> perl -de 42
>
> Loading DB routines from perl5db.pl version 1.28
> Editor support available.
>
> Enter h or `h h' for help, or `man perldebug' for more help.
>
> main::(-e:1): 42
> DB<1> sub foo {return 42}
>
>
>
> DB<2> s foo()
> main::((eval 7)[/usr/local/lib/perl5/5.8.6/perl5db.pl:628]:3):
> 3: foo();
>
>
> DB<<3>> s
> main::foo((eval 6)[/usr/local/lib/perl5/5.8.6/perl5db.pl:628]:2):
> 2: sub foo {return 42};
> DB<<3>>
>
>
>
> Which is quite awesome; I don't have to restart the program if I want
> to step through a given function call with a different set of values.
In your python shell:
import somelib
import pdb
pdb.runcall(somelib.somefunc, 42, foo='bar')
Also and IIRC, ipython (an alternative and more featurefull python
shell) has some interesting stuff wrt/ pdb integration.
More information about the Python-list
mailing list