9月13日,Python 3.5 正式发布。相对 3.4 版,3.5.x 系列主要新增的特性有:

新语法特性:

  • PEP 492, coroutines with async and await syntax.
  • PEP 465, 有一个用于矩阵乘法的运算符 @,比如: a @ b.
  • PEP 448, additional unpacking generalizations.

新库/模块:

新的内建特性:

  • bytes % argsbytearray % argsPEP 461 – "%-formatting" 用于 bytes 和 bytearray 对象
  • b'\xf0\x9f\x90\x8d'.hex()bytearray(b'\xf0\x9f\x90\x8d').hex()memoryview(b'\xf0\x9f\x90\x8d').hex()issue 9951 - A hexmethod has been added to bytes, bytearray, and memoryview.
  • memoryview now supports tuple indexing (including multi-dimensional). (Contributed by Antoine Pitrou in issue 23632.)
  • Generators 有了一个新属性 gi_yieldfrom , which returns the object being iterated by yield from expressions. (Contributed by Benno Leslie and Yury Selivanov in issue 24450.)
  • A new RecursionError exception is now raised when maximum recursion depth is reached. (Contributed by Georg Brandl in issue 19235.)

官方详细解释:https://docs.python.org/3.5/whatsnew/3.5.html

9 收藏


直接登录

推荐关注