Python 3.8.0 正式发布了,以下是主要更新内容:
PEP 572, 赋值表达式
PEP 570, 仅位置参数
PEP 587, Python 初始化配置(改进嵌入)
PEP 590, Vectorcall:CPython 的快速调用协议
PEP 578, 运行时审核挂钩
PEP 574, 带外数据的 Pickle 协议 5
Typing 相关:PEP 591,PEP 586,PEP 589
并行文件系统缓存,用于编译的字节码
调试版本与发行版本共享 ABI
f 字符串支持一个方便的 = 说明符进行调试
continue 现在在 finally: 块中
在 Windows 上,默认的异步事件循环现在是 ProactorEventLoop
在 macOS 上,默认情况下现在在多进程中使用 spawn start 方法
现在,多进程(multiprocessing)可以使用共享内存段
typed_ast 合并回 CPython
LOAD_GLOBAL 现在快了 40%
pickle 现在默认使用协议 4,提高了性能
Major new features of the 3.8 series, compared to 3.7
PEP 572, Assignment expressions
PEP 570, Positional-only arguments
PEP 587, Python Initialization Configuration (improved embedding)
PEP 590, Vectorcall: a fast calling protocol for CPython
PEP 578, Runtime audit hooks
PEP 574, Pickle protocol 5 with out-of-band data
Typing-related: PEP 591 (Final qualifier), PEP 586 (Literal types), and PEP 589 (TypedDict)
Parallel filesystem cache for compiled bytecode
Debug builds share ABI as release builds
f-strings support a handy = specifier for debugging
continue is now legal in finally: blocks
on Windows, the default asyncio event loop is now ProactorEventLoop
on macOS, the spawn start method is now used by default in multiprocessing
multiprocessing can now use shared memory segments to avoid pickling costs between processes
typed_ast is merged back to CPython
LOAD_GLOBAL is now 40% faster
pickle now uses Protocol 4 by default, improving performance