推荐学习书目
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
gtlions
V2EX  ›  Python

Python 多线程/进程的两种使用方式的区别

  •  
  •   gtlions · Sep 28, 2018 · 3608 views
    This topic created in 2793 days ago, the information mentioned may be changed or developed.
    Python 多线程 /进程的两种使用方式:1、初始化类并传入可调用对象; 2、继承类,重载相关方法,这两种方式在使用场景或者其他情况上有什么区别?
    7 replies    2018-09-28 21:11:48 +08:00
    xiaoshenke
        1
    xiaoshenke  
       Sep 28, 2018
    没有区别
    waterloocode
        3
    waterloocode  
       Sep 28, 2018
    推荐多进程 GIL 是个坑
    ClutchBear
        4
    ClutchBear  
       Sep 28, 2018
    都不用,
    用 celery
    glacer
        5
    glacer  
       Sep 28, 2018
    @waterloocode IO 密集型的情况下,多线程基本不受 GIL 影响
    wizardforcel
        6
    wizardforcel  
       Sep 28, 2018
    区别就是原始的`run()`的行为是调用`target(*args, **kwargs)`。
    frostming
        7
    frostming  
       Sep 28, 2018
    一般你要加入别的属性 /方法的时候用继承的方法,否则能直接实例化干嘛多此一举
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3018 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 39ms · UTC 05:38 · PVG 13:38 · LAX 22:38 · JFK 01:38
    ♥ Do have faith in what you're doing.