Esmail wrote:
Hi Ben,

Ben Finney wrote:

Whenever a simple output statement is too cumbersome for debugging, I
take it as a sign that the program is too cumbersome to follow.

I'll have to think about this .. though my gut says this is true :-)

That is not always true. When it comes to implement complex tasks, you can't always avoid writing complex code. Python does not get your code more complex than your algorithm, but it cannot always simplify it.

Ben is right when he says that code can often be written in a more simpler manner, but they are some occasions when you have to write complex code, that the print debug statement won't be efficient enough to sort things out. I personally develop/maintain a full application written in python (and quite complex for some parts), using the ipdb debugger just saved my hours (days) of headache about some very difficult bug to spot
re your other point about the interactive shell, I agree it's useful, but
to me still doesn't quite do what a full-fledged debugger can - but perhaps
that is a reflection of my skill with the shell at this point.

Always more to learn.

Esmail


90% of the time, print statements + ipython shell will do the trick. The post mortem debugging is also very useful. Execute your python file in ipython, then when it exits upon exception, execute
>>> import pdb ; pdb.pm()
You can then inspect the symbols easily.

JM
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to