On 9/4/05, Stephan Deibel <[EMAIL PROTECTED]> wrote: > On Sun, 4 Sep 2005, Guido van Rossum wrote: > > But more important to me are my own experiences exploring the > > boundaries of print. > > > > - I quite often come to a point in the evolution of a program where I > > need to change all print statements into logging calls, or calls into > > some other I/O or UI library. [...] > > FWIW, this almost always happens to me. Although I've learned to > avoid print in most cases, it was a somewhat painful lesson that seems > quite at odds with how the rest of Python is designed -- usually, > stuff just works and you aren't led into such design traps.
Happened to me too. However, there is an easy way out: hijack sys.stdout to forward to your logger system. I've got a web application framework that's setup like that right now, it works great (if you will not need the original print-to-stdout anymore in your program, that is). I print, it goes to the logfile. You just have to be careful where--in time-- you replace sys.stdout. cheers, _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com