[Twisted-Python] Small practice application

Glyph Lefkowitz glyph at twistedmatrix.com
Thu Sep 30 14:00:21 EDT 2010

On Sep 30, 2010, at 1:51 AM, Zubin Mithra wrote:

> However, I am confused on how to write data over to a particular player(0 or 1). Is there any way I could choose to write to a particular object?

Sure, make self.factory.connections into a dictionary which maps player names to connection objects, instead of a simple list.  Or simply do:

for connection in self.factory.connections:
  if connection.username == 'desired-username':

This isn't really a twisted question, it's a basic Python question :).

More information about the Twisted-Python mailing list