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

Tornado 4.3b1,支持 async/await 关键字

  •  
  •   janxin · Oct 19, 2015 · 3353 views
    This topic created in 4033 days ago, the information mentioned may be changed or developed.

    Highlights

    • The new async/await keywords in Python 3.5 are supported. In most cases, async def can be used in place of the @gen.coroutine decorator. Inside a function defined with async def, use await instead of yield to wait on an asynchronous operation. Coroutines defined with async/await will be faster than those defined with @gen.coroutine and yield, but do not support some features including .Callback/.Wait or the ability to yield a Twisted Deferred.
    • The async/await keywords are also available when compiling with Cython in older versions of Python.

    Deprecation notice

    • This will be the last release of Tornado to support Python 2.6 or 3.2. Note that PyPy3 will continue to be supported even though it implements a mix of Python 3.2 and 3.3 features.

    更多的请看:http://www.tornadoweb.org/en/latest/releases/next.html

    不知道 asyncio 的库是不是可以直接用在 Tornado 上面了,如果可以我就升到 3.5 了....

    10 replies  •  2015-10-19 22:53:53 +08:00
    aliuwr
    aliuwr
    Oct 19, 2015
    1
    Python 3.5 感觉好远
    janxin
    janxin
    OP
    Oct 19, 2015
    2
    @aliuwr 之前一直停留在 2.7 ,之前觉得 yield from 这个实在是不优雅,不过有 async/await 要好很多了
    echo1937
    echo1937
    Oct 19, 2015
    3
    还在 3.43,有先行者吗?
    chengzhoukun
    chengzhoukun
    Oct 19, 2015
    4
    JS 也快支持了
    Feiox
    Feiox
    Oct 19, 2015
    5
    @echo1937 我们已经开始实验 3.5 了,因为现在的项目使用了一些 asyncio 。其实对我们更有吸引力的是 typing 这个标准库 ~ 已经准备大刀阔斧的迁移了。
    话说, PHP7 Node 都配备了 JIT , CPython 何时来拯救我们 ~
    echo1937
    echo1937
    Oct 19, 2015
    6
    @Feiox 请问下,你们是什么项目?
    Feiox
    Feiox
    Oct 19, 2015
    7
    @echo1937 一个不太要求速度的爬虫,一些业务逻辑,还有几个内部使用的 Py 库(处理抽象业务逻辑的)。主要还是和 Web 业务、文本数据的处理有关。
    PythonAnswer
    PythonAnswer
    Oct 19, 2015
    8
    感觉 tornado 又要来一波爆发了.
    django 之类的不知道什么时候才能引入 async await
    fy
    fy
    Oct 19, 2015
    9
    3.4 的时候就已经转了 py3 ,感觉良好。

    顺便再厚着脸皮推一下自己的 Tornado 项目模板: https://github.com/fy0/fpage
    janxin
    janxin
    OP
    Oct 19, 2015
    10
    @PythonAnswer django 本来就是同步模型,跟异步关系应该不大,即使引入范围也不会大的
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1311 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 19:57 · PVG 03:57 · LAX 11:57 · JFK 14:57
    ♥ Do have faith in what you're doing.