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

小白求问, Python3 中使用 Tornado 的一个不解。

  •  
  •   Via8veritas · Nov 6, 2019 · 4381 views
    This topic created in 2516 days ago, the information mentioned may be changed or developed.

    为什么在一个方法中使用多次 yield 关键字,方法返回的是 generator 对象。但是只有一个 yield 关键字的时候,方法是正常执行异步任务的。 希望大佬指点迷津。

    7 replies  •  2019-11-07 14:51:33 +08:00
    wangyzj
        1
    wangyzj  
       Nov 6, 2019
    code 呢?
    ayase252
        2
    ayase252  
       Nov 6, 2019   ❤️ 1
    盲猜一个,框架只 next 了一次。可能对应文档中会提到。(没用过这个框架
    Trim21
        3
    Trim21  
       Nov 6, 2019
    为啥都 python3 了还要用 yield, 而直接用 async await...
    Trim21
        4
    Trim21  
       Nov 6, 2019
    @Trim21 #3 而不*
    wangyzj
        5
    wangyzj  
       Nov 6, 2019
    @Trim21 得考虑 python2 不是
    quietnight
        6
    quietnight  
       Nov 7, 2019 via iPhone
    code 有问题,查下 yield 得用法。
    NoAnyLove
        7
    NoAnyLove  
       Nov 7, 2019   ❤️ 1
    这种问题难道不是看代码一分钟就能解决的? github.com/tornadoweb/tornado/blob/master/tornado/gen.py#L203
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2778 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 13:58 · PVG 21:58 · LAX 06:58 · JFK 09:58
    ♥ Do have faith in what you're doing.