推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
chu8129
V2EX  ›  Python

python 中的三种 Queue 有什么区别??

  •  
  •   chu8129 ·
    chu8129 · Apr 9, 2016 · 7045 views
    This topic created in 3714 days ago, the information mentioned may be changed or developed.

    python 中有三种 Queue ;但不是很清楚三个之间的区别;希望了解的大神解释一下:


    import Queue
    myqueue = Queue.Queue()

    from multiprocessing import Queue
    myqueue = Queue.Queue()

    import multiprocessing
    manager=multiprocessing.Manager()
    myqueue=manager.Queue()
    3 replies    2016-04-09 20:42:18 +08:00
    icedx
        1
    icedx  
       Apr 9, 2016   ❤️ 1
    Queue.Queue 是进程内非阻塞队列
    multiprocess.Queue 是跨进程通信队列
    前者是各自进程私有, 后者是各子进程共有
    chu8129
        2
    chu8129  
    OP
       Apr 9, 2016
    @icedx 非常感谢;那 manager 那个呢?
    icedx
        3
    icedx  
       Apr 9, 2016
    @chu8129 .Manager 是 multiprocessing 的封装 .Manager.Queue 和 Queue, multiprocessing.Queue 没有太大关系
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5448 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 06:47 · PVG 14:47 · LAX 23:47 · JFK 02:47
    ♥ Do have faith in what you're doing.