Python 3.x Python3不添加';自我';类函数调用

Python 3.x Python3不添加';自我';类函数调用,python-3.x,python-asyncio,python-object,Python 3.x,Python Asyncio,Python Object,我在python 3.4中有一个asyncio类: class Type1: def __init__(s,websocket,path,flds,MyId): global TypeOnes s.ws=websocket s.pt=path s.iId=flds s.ID=MyId s.cnt=0 TypeOnes[MyId]=s s.Q=asyncio.Q

我在python 3.4中有一个asyncio类:

class Type1:

    def __init__(s,websocket,path,flds,MyId):
        global TypeOnes
        s.ws=websocket
        s.pt=path
        s.iId=flds
        s.ID=MyId
        s.cnt=0
        TypeOnes[MyId]=s
        s.Q=asyncio.Queue


    @asyncio.coroutine
    def handlerIn(s,rxed):
        #yield from s.Q.put(rxed)  # gave error missing positional 'item'
        #yield from s.Q.put(item=rxed)   # gave error missing positional 'self'
        yield from s.Q.put(self=s.Q,item=rxed) # gave error TypeError: _consume_done_getters() missing 1 required positional argument: 'self'
当调用HandlerIn时,我似乎无法调用Q.put,有关尝试和结果,请参阅注释代码

就好像自我没有被正确插入

我在调试器中,已检查变量的内容:

(handlerIn)>>> s.Q
<class 'asyncio.queues.Queue'>

(handlerIn)>>> rxed
'Button'
(handlerIn)>>s.Q
(handlerIn)>>>>RX
“按钮”

我认为问题在于您尚未创建
asyncio.Queue的实例。应该是

s.Q=asyncio.Queue()

我认为问题在于您尚未创建
asyncio.Queue
的实例。应该是

s.Q=asyncio.Queue()