ツイストでは、self.transport.write () と self.sendLine () の呼び出しの違いは何ですか? たとえば、次のプログラムは、 lineReceived メソッドで何を呼び出しても同じように動作します。
class FooProtocol(basic.LineReceiver):
delimiter = '\n'
def connectionMade(self):
self.sendLine("Foo")
def lineReceived(self, line):
self.sendLine("Echoed: " + line)
#self.transport.write("Echoed: " + line + "\n")
if __name__ == "__main__":
stdio.StandardIO(FooProtocol())
reactor.run()
これを行うためのよりpythonic(またはtwstedic ...)な方法はありますか?
前もって感謝します !