:
, - .
:
BaseEventLoop.create_connection BaseEventLoop._create_connection_transport ref, Protocol :
protocol = protocol_factory()
, , :
class Prococol:
pass
def create_connection(Protocol):
protocol = Protocol()
create_connection(Protocol)
, "protocol = Protocol()" . :
class Protocol:
def __init__(self, a):
self.a = a
def create_connection(Protocol):
protocol = Protocol()
create_connection(lambda: Protocol(1))
, OP :
class Protocol:
def __init__(self, a):
self.a = a
def __call__(self):
return self
def create_connection(Protocol):
protocol = Protocol()
create_connection(Protocol(1))
, , , , . , - , create_connection(lambda: Protocol(1)) , create_connection, , , , , .
Udi , def __call__(self): return self create_server (, , ), -. , , , , create_server. :
class Protocol:
def __init__(self, a):
self.a = a
def __call__(self):
return Protocol(self.a)
__call__, -. , , .