@lib.bind(bindto, data=channel)
class BasicServer(object):
def __init__(self, sock, data):
- # The lambda bit is needed to make this copy the value-at-definition instead of using the closure value-at-runtime
+ # NB neither directly referencing `channel`, nor trying to pass it through a default-arg-to-a-lambda like the python docs suggest, works here.
+ # Yay python. At least passing it via bind works.
self.chan = data
- print(repr(self.chan))
self.buffer = b''
self.sock = sock