[Twisted-Python] transport.write(a + b) versus [transport.write(a); transport.write(b)]

Carlos Valiente superdupont at gmail.com
Wed Feb 16 05:00:36 MST 2011


>From twisted.protocols.basic.IntNStringReceiver.sendString():

 def sendString(self, string):
     self.transport.write(
         struct.pack(self.structFormat, len(string)) + string)

Would it make sense to do something like this instead:

 def sendString(self, string):
     self.transport.write(
         struct.pack(self.structFormat, len(string)))
     self.transport.write(string)

in order to avoid the creation of the extra string object?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20110216/a7486028/attachment.html>


More information about the Twisted-Python mailing list