@@ -533,19 +533,23 @@ msgid ""
533533"transformation using the ``@wrapper`` syntax. Common examples for "
534534"decorators are :func:`classmethod` and :func:`staticmethod`."
535535msgstr ""
536+ "返回值为另一个函数的函数,通常使用 ``@wrapper`` 语法形式来进行函数变换。装饰器的常见例子包括 :func:`classmethod` 和 "
537+ ":func:`staticmethod`。"
536538
537539#: ../../glossary.rst:261
538540msgid ""
539541"The decorator syntax is merely syntactic sugar, the following two function "
540542"definitions are semantically equivalent::"
541- msgstr ""
543+ msgstr "装饰器语法只是一种语法糖,以下两个函数定义在语义上完全等价:: "
542544
543545#: ../../glossary.rst:272
544546msgid ""
545547"The same concept exists for classes, but is less commonly used there. See "
546548"the documentation for :ref:`function definitions <function>` and :ref:`class"
547549" definitions <class>` for more about decorators."
548550msgstr ""
551+ "同的样概念也适用于类,但通常较少这样使用。有关装饰器的详情可参见 :ref:`函数定义 <function>` 和 :ref:`类定义 <class>`"
552+ " 的文档。"
549553
550554#: ../../glossary.rst:275
551555msgid "descriptor"
@@ -563,11 +567,15 @@ msgid ""
563567"including functions, methods, properties, class methods, static methods, and"
564568" reference to super classes."
565569msgstr ""
570+ "任何定义了 :meth:`__get__`, :meth:`__set__` 或 :meth:`__delete__` "
571+ "方法的对象。当一个类属性为描述符时,它的特殊绑定行为就会在属性查找时被触发。通常情况下,使用 *a.b* 来获取、设置或删除一个属性时会在 *a* "
572+ "的类字典中查找名称为 *b* 的对象,但如果 *b* 是一个描述符,则会调用对应的描述符方法。理解描述符的概念是更深层次理解 Python "
573+ "的关键,因为这是许多重要特性的基础,包括函数、方法、属性、类方法、静态方法以及对超类的引用等等。"
566574
567575#: ../../glossary.rst:287
568576msgid ""
569577"For more information about descriptors' methods, see :ref:`descriptors`."
570- msgstr ""
578+ msgstr "有关描述符的方法的详情可参看 :ref:`descriptors`。 "
571579
572580#: ../../glossary.rst:288
573581msgid "dictionary"
@@ -579,6 +587,8 @@ msgid ""
579587"can be any object with :meth:`__hash__` and :meth:`__eq__` methods. Called a"
580588" hash in Perl."
581589msgstr ""
590+ "一个关联数组,其中的任意键都映射到相应的值。键可以是任何具有 :meth:`__hash__` 和 :meth:`__eq__` 方法的对象。在 "
591+ "Perl 语言中称为 hash。"
582592
583593#: ../../glossary.rst:293
584594msgid "dictionary view"
@@ -592,6 +602,9 @@ msgid ""
592602"the view reflects these changes. To force the dictionary view to become a "
593603"full list use ``list(dictview)``. See :ref:`dict-views`."
594604msgstr ""
605+ "从 :meth:`dict.keys`, :meth:`dict.values` 和 :meth:`dict.items` "
606+ "返回的对象被称为字典视图。它们提供了字典条目的一个动态视图,这意味着当字典改变时,视图也会相应改变。要将字典视图强制转换为真正的列表,可使用 "
607+ "``list(dictview)``。参见 :ref:`dict-views`。"
595608
596609#: ../../glossary.rst:301
597610msgid "docstring"
@@ -605,6 +618,8 @@ msgid ""
605618"class, function or module. Since it is available via introspection, it is "
606619"the canonical place for documentation of the object."
607620msgstr ""
621+ "作为类、函数或模块之内的第一个表达式出现的字符串字面值。它在代码执行时会被忽略,但会被解释器识别并放入所在类、函数或模块的 "
622+ ":attr:`__doc__` 属性中。由于它可用于代码内省,因此是对象存放文档的规范位置。"
608623
609624#: ../../glossary.rst:309
610625msgid "duck-typing"
@@ -622,6 +637,10 @@ msgid ""
622637"classes <abstract base class>`.) Instead, it typically employs "
623638":func:`hasattr` tests or :term:`EAFP` programming."
624639msgstr ""
640+ "指一种编程风格,它并不依靠查找对象类型来确定其是否具有正确的接口,而是直接调用或使用其方法或属性 "
641+ "(\" 看起来像鸭子,叫起来也像鸭子,那么肯定就是鸭子。\" ) 由于强调接口而非特定类型,设计良好的代码可通过允许多态替代来提升灵活性。鸭子类型避免使用"
642+ " :func:`type` 或 :func:`isinstance` 检测。(但是请注意,鸭子类型可以使用 :term:`抽象基类 <abstract "
643+ "base class>` 作为补充。) 而往往会采用 :func:`hasattr` 检测或是 :term:`EAFP` 编程。"
625644
626645#: ../../glossary.rst:320
627646msgid "EAFP"
0 commit comments