On Sun, 08 May 2016 23:01:55 +1000, Chris Angelico wrote: > ... 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). Part A is often the important bit :) ...
Having spent a long time developing embedded systems, I wholeheartedly agree. In spirit. Isn't that what the logging module is for? Fine grained control, as centralized or distributed as is warranted, over program output? > ... The trouble with a verbose flag controlling all print() calls is > that IIDPIO debugging suddenly doesn't work; plus, it's easy to copy > and paste code to some other module and not notice that you don't have > a verbosity check at the top, and then wonder why disabling verbose > doesn't fully work. Both problems are solved by having a dedicated > spam function, which will simply error out if you didn't set it up > properly. Hey! That sounds just like the logging module.... ;-) Dan -- https://mail.python.org/mailman/listinfo/python-list