Python 3.5:"async with" 导致语法错误。为什么?

Python 3.5: "async with" results in SyntaxError. Why?

我正在使用 Python 3.5,根据 PEP 492 应该可以访问 async with 语法,但是当我尝试使用它时出现 SyntaxError。我做错了什么?

In [14]: sys.version
Out[14]: '3.5.2 (default, Oct 11 2016, 04:59:56) \n[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)]'

In [15]: async with aiohttp.ClientSession() as session:
  File "<ipython-input-15-9799c5ce74cf>", line 1
    async with aiohttp.ClientSession() as session:
             ^
SyntaxError: invalid syntax

如果没有 async 功能,您将无法使用 async with。作为 docs say:

It is a SyntaxError to use async with outside of an async def function.

但是这段代码可以工作:

async def some_function():
    async with aiohttp.ClientSession() as session:
        pass

或者查看 docs 中的示例。