On 05/08/2016 06:01 AM, Chris Angelico wrote:
[snip...]
... I like to recommend a
little thing called "IIDPIO debugging" - If In Doubt, Print It Out.
That means: If you have no idea what a piece of code is doing, slap in
a print() call somewhere. It'll tell you that (a) the code is actually
being executed, and (b) whatever info you put between the parens
(ideally, some key variable or parameter)...
My personal variation of IIPPID debugging is to use input() instead of print().
For example:
input('x = {}, y = {} --> '.format(x, y))
Then the program stops at this point so you can examine the values. <Enter> will continue the
program or ^C will abort (if you see what the problem is now). Of course this can't be used in
all situations, but it's handy where it can.
Note that my personal preference is to stick that "-->" as a prompt at the end, but obviously
this (or a similar marker) is optional.
--
https://mail.python.org/mailman/listinfo/python-list