0

我正在尝试在调用 manager.list 时使用我的列表子类。所以,我可以添加自己的方法,但它不起作用。是否有可能做到这一点?

class mylist(list):
    def __init__(self, *args):
        super().__init__(*args)
                 
myinherit = mylist()
#myinherit.append(2)

import multiprocessing as mp
mpl    = mp.Manager()
llist  = mpl.list(myinherit)
llist.append(10)



    raise convert_to_error(kind, result)

RemoteError: 
---------------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\E0238015\Anaconda3\envs\zezo\lib\multiprocessing\managers.py", line 193, in handle_request
    request = c.recv()
  File "C:\Users\E0238015\Anaconda3\envs\zezo\lib\multiprocessing\connection.py", line 251, in recv
    return _ForkingPickler.loads(buf.getbuffer())
AttributeError: Can't get attribute 'mylist' on <module '__main__' (built-in)>
---------------------------------------------------------------------------
4

0 回答 0