@@ -847,6 +847,11 @@ msgid ""
847
847
"writing decorators and any code that validates or amends calling signatures "
848
848
"or arguments."
849
849
msgstr ""
850
+ "新增的函数 :func:`inspect.signature` 使得对 python 可调用对象的内省更为简单直观。 "
851
+ "多种可调用对象均受到支持:不论是否带装饰器的 python 函数,类以及 :func:`functools.partial` 对象。 新增的类 "
852
+ ":class:`inspect.Signature`, :class:`inspect.Parameter` 和 "
853
+ ":class:`inspect.BoundArguments` "
854
+ "保存了有关调用签名的信息,如标注、默认值、形参类别和绑定参数等,这极大地简化了编写装饰器和其他任何验证或修改调用签名或参数的工作。"
850
855
851
856
#: ../../whatsnew/3.3.rst:641
852
857
msgid ":pep:`362`: - Function Signature Object"
@@ -881,6 +886,9 @@ msgid ""
881
886
"only a small portion of the implementation-specific data. Over time that "
882
887
"ratio will shift in order to make the standard library more portable."
883
888
msgstr ""
889
+ "``sys.implementation`` 的目的是将标准库所使用的具体实现专属数据合并到一个命名空间中。 这允许不同的 Python "
890
+ "实现能更方便地共享同一个标准库基准代码。 在其初始状态中,``sys.implementation`` 只保持具体实现专属数据的一小部分。 "
891
+ "随着时间推移这个比例将进行调整以使标准库具有更好的可移植性。"
884
892
885
893
#: ../../whatsnew/3.3.rst:660
886
894
msgid ""
@@ -890,10 +898,14 @@ msgid ""
890
898
"``importlib`` for its built-in import system may use ``cache_tag`` to "
891
899
"control the caching behavior for modules."
892
900
msgstr ""
901
+ "标准库可移植性提高的一个例子是 ``cache_tag``。 在 Python 3.3 "
902
+ "中,``sys.implementation.cache_tag`` 被 :mod:`importlib` 用来支持与 :pep:`3147` "
903
+ "的一致性。 任何使用 ``importlib`` 来处理内置导入系统的 Python 实现都可使用 ``cache_tag`` "
904
+ "来控制各个模块的缓存行为。"
893
905
894
906
#: ../../whatsnew/3.3.rst:667
895
907
msgid "SimpleNamespace"
896
- msgstr ""
908
+ msgstr "SimpleNamespace "
897
909
898
910
#: ../../whatsnew/3.3.rst:669
899
911
msgid ""
@@ -904,6 +916,10 @@ msgid ""
904
916
"are writable. This means that you can add, remove, and modify the namespace"
905
917
" through normal attribute access."
906
918
msgstr ""
919
+ "``sys.implementation`` 的实现还为 Python 引入了一个新类型: "
920
+ ":class:`types.SimpleNamespace`。 相比基于映射的命名空间像是 "
921
+ ":class:`dict`,``SimpleNamespace`` 是基于属性的,像是 :class:`object`。 不过,与 ``object``"
922
+ " 不同,``SimpleNamespace`` 实例是可写的。 这意味着你可以通过常规的属性访问来添加、移除和修改命名空间。"
907
923
908
924
#: ../../whatsnew/3.3.rst:678
909
925
msgid ":pep:`421` - Adding sys.implementation"
0 commit comments