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