Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If for some reason you wanted to do this, you could just do

  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.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: