gen.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:aweasome_learning 作者: Knight-ZXW 项目源码 文件源码
def sleep(duration):
    """Return a `.Future` that resolves after the given number of seconds.

    When used with ``yield`` in a coroutine, this is a non-blocking
    analogue to `time.sleep` (which should not be used in coroutines
    because it is blocking)::

        yield gen.sleep(0.5)

    Note that calling this function on its own does nothing; you must
    wait on the `.Future` it returns (usually by yielding it).

    .. versionadded:: 4.1
    """
    f = Future()
    IOLoop.current().call_later(duration, lambda: f.set_result(None))
    return f
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号