V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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
kingname
V2EX  ›  Python

多进程应该使用多个 Queue 通信吗

  •  
  •   kingname ·
    kingname · 2015-04-24 13:50:55 +08:00 · 1995 次点击
    这是一个创建于 3290 天前的主题,其中的信息可能已经有所发展或是发生改变。
    我在使用mutiprocess的Process生成了几个不同的子进程,现在使用Queue通信。由于不同的进程之间传递的信息不同,因此我使用了多个Queue。这种方式运行起来功能上是没有问题的,但是我想请问,在Python的编码规范中,这样写是否合适?会不会有什么隐患?
    1 条回复    2015-04-25 00:46:36 +08:00
    GeekGao
        1
    GeekGao  
       2015-04-25 00:46:36 +08:00   ❤️ 1
    “由于不同的进程之间传递的信息不同,因此我使用了多个Queue” 不是很理解你为什么这样做。但这跟Python编码规范没关系的。可以传多个multiprocessing.Queue()实例的。协调好生产者和消费者即可,之外没啥隐患。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2883 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 14:28 · PVG 22:28 · LAX 07:28 · JFK 10:28
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.