Is multiprocessing.Manager().dict().setdefault() broken?

后端 未结 3 1947
抹茶落季
抹茶落季 2021-01-05 03:00

The its-late-and-im-probably-stupid department presents:

>>> import multiprocessing
>>> mgr = multiprocessing.Manager()
>>> d = mg         


        
3条回答
  •  温柔的废话
    2021-01-05 03:54

    The Manager().dict() is a DictProxy object:

    >>> mgr.dict()
    
    >>> type(mgr.dict())
    
    

    DictProxy is a subclass of the BaseProxy type, which does not behave entirely like a normal dict: http://docs.python.org/library/multiprocessing.html?highlight=multiprocessing#multiprocessing.managers.BaseProxy

    So, it seems you have to address the mgr.dict() differently than you would a base dict.

提交回复
热议问题