debugging in eclipse
roy at panix.com
Thu Nov 15 14:54:08 CET 2012
In article <mailman.3714.1352986928.27098.python-list at python.org>,
Dave Angel <d at davea.name> wrote:
> I'd also add a print statement, just to assure yourself that it's running.
My trick to make sure something is running is to add "assert 0".
To be fair, I usually start by adding a print statement, as Dave
suggests. If I see the output, I know it ran. But if I don't see the
output, there's two possibilities. Either it didn't run, or it ran but
something snarfed the output and hid it from my eyes. That's common in
test frameworks. It's also common in background processes where stdout
goes who-knows-where, and it's anybody's guess how the logging config
might be borked.
On the other hand, an "assert 0" is pretty much guaranteed to produce
some visible evidence that it ran. About the only thing that would stop
it is if somebody had wrapped the code in a try block which caught
AssertionError (or Exception).
More information about the Python-list