Debugging Python ?
logistix at cathoderaymission.net
logistix at cathoderaymission.net
Tue Jul 29 00:13:43 EDT 2003
More information about the Python-list mailing list
Tue Jul 29 00:13:43 EDT 2003
- Previous message (by thread): Debugging Python ?
- Next message (by thread): Debugging Python ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
pedro.werneck at bol.com.br (Pedro Werneck) wrote in message news:<ef72fb2b.0307281449.6b144be7 at posting.google.com>... > I use: > > if __debug__: print "bla, bla, bla..." > > And I was just wondering if it's legal to define a "print" function... > isn't print a keyword ? Instead of defining "print" you can assign a custom class to sys.stdout. Then all the print statements get automagically redirected.: if __debug__: class newStdout: def write(self,string): print string else: class newStdout: def write(self,string): pass import sys sys.stdout = newStdout()
- Previous message (by thread): Debugging Python ?
- Next message (by thread): Debugging Python ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list