How to actually write a program?
Max M
maxm at mxm.dk
Tue Sep 7 07:21:48 EDT 2004
Anna Martelli Ravenscroft wrote:
> One other tip: add lots of print statements. Print statements are your
> friend. They can help you figure out what it's *actually* doing, (and more
> importantly sometimes: what it's *NOT* doing) rather than just what you
> hope it might be doing. For example, when you start on defining funcx(a),
> you could start by having it just print what you gave it for arguments.
> You can always comment out or remove the print statements afterwards.
If you intend to use print that way it might be more efficient to write
a special test print function.
def tp(text):
TEST = 1
if TEST:
print text
That way you will only have to set TEST = 0 to avoid printing debug
print statements.
regards Max M
More information about the Python-list
mailing list