[Numpy-discussion] Are there command similar as Matlab find command?

David Cournapeau david@ar.media.kyoto-u.ac...
Mon Sep 29 23:28:45 CDT 2008


frank wang wrote:
> Hi, Robert,
>  
> Thank you very much for clarification of this.
>  
> I really do not know the difference of debug mode and the pdb debugger.

That's totally different in principle. Debug mode means your code is
compiled/interpreted differently to keep as much information as
possible, even if it makes your code run slower. But it can still be run
under the normal running environment (python interpreter in python's case).

A debugger is a *different* running environment, often specialized for
introspection, to do things not normally possible. Here, pdb. Generally,
for a debugger to be useful, your code has to be interpreted/run in
debug mode, though (but does not have to be in principle; just less
information). Running under a debugger can also mean your code run
significantly slower depending on what you do.

If you are familiar with C, debug mode in python is like compiling with
-g -DDEBUG with gcc, and debugger is running gdb.

> To me, it seems that pdb is only way to debug the python code. How do
> the expert of numpy/python debug their code? Are there any more
> efficient way to debug the code in python world? I used to use matlab
> which comes with a nice debugger.

It depends on the kind of bugs. In python, the "print method" is much
more powerful than in C because you can inspect many things (you can
even go into the stack to know which function called any entry point,
for example, although the debugger makes it a bit easier I guess).
Personally, I rarely if ever use the python debugger.

cheers,

David




More information about the Numpy-discussion mailing list