why don't many test frameworks support file-output?

Scott David Daniels scott.daniels at acm.org
Fri Feb 24 10:43:20 EST 2006


kanchy kang wrote:
> 
> I don't think redirecting stdout to a file is a good resolution.
Nobody is suggesting:
     python program.py >output
or
     program.py >output

What is being suggested is:
     import sys
     import module
     original, sys.stdout = sys.stdout, open('output', 'w')
     try:
         module.main()
     finally:
         result, sys.stdout = sys.stdout, original
         size = result.tell()
         result.close()
         print size, 'bytes written to file "output"'

If, however, you want everyone else to conform to your personal idea
of "best practices," then hire them and tell them to do it your way.

--Scott David Daniels
scott.daniels at acm.org



More information about the Python-list mailing list