__init__ with write:
class Logwriter():
def __init__(self):
self.terminal = sys.stdout
self.lock = threading.Lock()
def write(self,message):
with self.lock:
self.terminal.write(message)
, , print "hello" sys.stdout.write("hello"), sys.stdout.write("\n").
, Alex Martelli.