gen.py 文件源码

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

项目:annotated-py-tornado 作者: hhstore 项目源码 文件源码
def maybe_future(x):
    """Converts ``x`` into a `.Future`.

    If ``x`` is already a `.Future`, it is simply returned; otherwise
    it is wrapped in a new `.Future`.  This is suitable for use as
    ``result = yield gen.maybe_future(f())`` when you don't know whether
    ``f()`` returns a `.Future` or not.
    """
    if is_future(x):
        return x
    else:
        fut = Future()
        fut.set_result(x)
        return fut
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号