python3.X版本特性表
Python版本 | 新特性 |
---|---|
3.0 | - 新式字符串格式化 - print()函数变为语句 - 异常机制改进 - 新的I/O库:io - 元类的定义方式改变 |
3.1 | - mtrandom模块 - bytes类型 - Python 2/3混合编码支持 - super()函数改进 - 新的测试工具unittest2 |
3.2 | - functools.lru_cache() - yield from语法 - 新的decimal模块 - 新的os.scandir()方法 - 新的time.perf_counter()函数 |
3.3 | - yield from改进 - 新的ipaddress模块 - 新的lzma模块 - 新的faulthandler模块 - 新的venv模块 |
3.4 | - asyncio库 - 新的enum模块 - 新的pathlib模块 - 新的statistics模块 - 新的tracemalloc模块 |
3.5 | - 新的async/await语法 - 新的typing模块 - 新的zipapp模块 - 新的pathlib.Path().replace()方法 - 新的math.isclose()函数 |
3.6 | - f-strings - asyncio库改进 - 新的secrets模块 - 新的pathlib.Path().read_text()和Path().write_text()方法 - 新的可变字典类型:collections.ChainMap |
3.7 | - 新的asyncio库特性 - 新的contextvars模块 - 新的dataclasses模块 - 新的breakpoint()函数 - 新的math.prod()函数 |
3.8 | - 海象运算符(:=) - 新的re.Match对象 - 新的functools.cache()函数 - 新的pickle协议版本:v5 - 新的statistics.quantiles()函数 |
3.9 | - 字典合并操作符( |
3.10 | - 新的match语句 - 可选的结尾逗号语法 - 新的装饰器语法 - 新的time.ns_time()函数 - 新的statistics.multimode()函数 |
3.11 | - PEG语法解析器 - 新的zipfile.Path类型 - 新的zoneinfo.get_zonekey()函数 - 新的http.client.HTTPSConnection类的context参数 - 新的math.dist()函数 |