@@ -492,6 +492,12 @@ msgid ""
492
492
"of strings, filenames that cannot be decoded properly are omitted rather "
493
493
"than raising :exc:`UnicodeError`."
494
494
msgstr ""
495
+ "文件名是以(Unicode)字符串的形式传给 API 并返回的。 这可能产生特定平台专属的问题因为在某些平台上文件名强制使用字节串。 (另一方面,在 "
496
+ "Windows 上文件名则原生存储为 Unicode。) 为绕过此问题,多数接受文件名的 API(例如 :func:`open` 和 :mod:`os`"
497
+ " 模块中的许多函数)都同时接受 :class:`bytes` 对象和字符串,而少数 API 会发出要求 :class:`bytes` 返回值的提示。 "
498
+ "因而,当参数为 :class:`bytes` 的实例时 :func:`os.listdir` 会返回由 :class:`bytes` "
499
+ "实例组成的列表,:func:`os.getcwdb` 则会将当前工作目录作为 :class:`bytes` 实例返回。 请注意当 "
500
+ ":func:`os.listdir` 返回字符串的列表时,无法被正确解码的文件名会被忽略而不是引发 :exc:`UnicodeError`。"
495
501
496
502
#: ../../whatsnew/3.0.rst:325
497
503
msgid ""
@@ -560,6 +566,8 @@ msgid ""
560
566
"intent is to encourage experimentation through metaclasses, decorators or "
561
567
"frameworks."
562
568
msgstr ""
569
+ ":pep:`3107`: 函数参数和返回值标注。 这提供了一种标注函数形参和返回值的标准方式。 并没有与这种标注相关联的特殊语法而只是可以使用 "
570
+ ":attr:`!__annotations__` 属性在运行时对它们进行内省。 其目的是鼓励在元类、装饰器和框架中尝试应用标注。"
563
571
564
572
#: ../../whatsnew/3.0.rst:363
565
573
msgid ""
@@ -586,6 +594,8 @@ msgid ""
586
594
"now assign directly to a variable in an outer (but non-global) scope. "
587
595
":keyword:`!nonlocal` is a new reserved word."
588
596
msgstr ""
597
+ ":pep:`3104`: :keyword:`nonlocal` 语句。 现在你可以使用 ``nonlocal x`` "
598
+ "来允许直接赋值到一个外层(但非全局)作用域。 :keyword:`!nonlocal` 是新的保留字。"
589
599
590
600
#: ../../whatsnew/3.0.rst:378
591
601
msgid ""
@@ -594,6 +604,8 @@ msgid ""
594
604
"``rest`` object is always a (possibly empty) list; the right-hand side may "
595
605
"be any iterable. Example::"
596
606
msgstr ""
607
+ ":pep:`3132`: 扩展可迭代对象解包。 你现在可以编写像 ``a, b, *rest = some_sequence`` 这样的代码。 甚至 "
608
+ "``*rest, a = stuff``。 ``rest`` 对象将总是为一个(可能为空的)列表;右侧的对象可以是任意可迭代对象。 例如::"
597
609
598
610
#: ../../whatsnew/3.0.rst:383
599
611
msgid "(a, *rest, b) = range(5)"
@@ -704,6 +716,8 @@ msgid ""
704
716
"(It was a crutch to make it easier to default to new-style classes without "
705
717
"deriving every class from :class:`object`.)"
706
718
msgstr ""
719
+ "模块级全局变量 :data:`!__metaclass__` 已不再受支持。 (它是一个令默认使用新式类而无需从 :class:`object` "
720
+ "派生每一个类的辅助工具。)"
707
721
708
722
#: ../../whatsnew/3.0.rst:436
709
723
msgid ""
0 commit comments