怎么看twistedapi的问题
刚学python,想问下twisted文档里边为什么没类属性条目呢,比如BaseProtocol里边有connected,和transport属性,API文档里哪有说明啊,
from twisted.internet.protocol import Protocol
class Echo(Protocol):
def dataReceived(self, data):
self.transport.write(data)
我该怎么知道self能调用transport,transport里边还有write呢,刚学,能不能具体给我API文档里边找的步骤说明一下啊 python twisted
[解决办法]
摘自BaseProtocol的文档(http://twistedmatrix.com/documents/11.0.0/api/twisted.internet.protocol.BaseProtocol.html):
My API is quite simple. Implement dataReceived(data) to handle both event-based and synchronous input; output can be sent through the 'transport' attribute, which is to be an instance that implements twisted.internet.interfaces.ITransport.