Though I don't know of an effortless way to disable debug prints, you can easily redirect to a file.
import sys print >>sys.stderr, "STDERR is fun."
There's not too much that suggests using this instead of logging.
import sys print >>sys.stderr, "STDERR is fun."
There's not too much that suggests using this instead of logging.
import sys
def debug(*s, sep=" ", nl="\n"):
print >>sys.stderr, sep.join(map(str, s)), nl,
pass
debug("There was an error on line", 10, ":", nl="")
debug(1,2,3,4,5, sep="-")
And then comment out the line with "print" to disable it.Of course, by that point you may as well use the logging module.