@@ -3310,54 +3310,57 @@ msgstr ""
33103310msgid ""
33113311"Typical uses of context managers include saving and restoring various kinds "
33123312"of global state, locking and unlocking resources, closing opened files, etc."
3313- msgstr ""
3313+ msgstr "上下文管理器的典型用法包括保存和恢复各种全局状态,锁定和解锁资源,关闭打开的文件等等。 "
33143314
33153315#: ../../reference/datamodel.rst:2437
33163316msgid ""
33173317"For more information on context managers, see :ref:`typecontextmanager`."
3318- msgstr ""
3318+ msgstr "要了解上下文管理器的更多信息,请参阅 :ref:`typecontextmanager`。 "
33193319
33203320#: ../../reference/datamodel.rst:2442
33213321msgid ""
33223322"Enter the runtime context related to this object. The :keyword:`with` "
33233323"statement will bind this method's return value to the target(s) specified in"
33243324" the :keyword:`as` clause of the statement, if any."
33253325msgstr ""
3326+ "进入关联到此对象的运行时上下文。 :keyword:`with` 语句会将此方法的返回值绑定到 :keyword:`as` "
3327+ "子句所指定的目标(如果有的话)。"
33263328
33273329#: ../../reference/datamodel.rst:2449
33283330msgid ""
33293331"Exit the runtime context related to this object. The parameters describe the"
33303332" exception that caused the context to be exited. If the context was exited "
33313333"without an exception, all three arguments will be :const:`None`."
33323334msgstr ""
3335+ "退出关联到此对象的运行时上下文。 各个参数描述了导致上下文退出的异常。 如果上下文是无异常地退出的,三个参数都将为 :const:`None`。"
33333336
33343337#: ../../reference/datamodel.rst:2453
33353338msgid ""
33363339"If an exception is supplied, and the method wishes to suppress the exception"
33373340" (i.e., prevent it from being propagated), it should return a true value. "
33383341"Otherwise, the exception will be processed normally upon exit from this "
33393342"method."
3340- msgstr ""
3343+ msgstr "如果提供了异常,并且希望方法屏蔽此异常(即避免其被传播),则应当返回真值。 否则的话,异常将在退出此方法时按正常流程处理。 "
33413344
33423345#: ../../reference/datamodel.rst:2457
33433346msgid ""
33443347"Note that :meth:`__exit__` methods should not reraise the passed-in "
33453348"exception; this is the caller's responsibility."
3346- msgstr ""
3349+ msgstr "请注意 :meth:`__exit__` 方法不应该重新引发被传入的异常,这是调用者的责任。 "
33473350
33483351#: ../../reference/datamodel.rst:2464
33493352msgid ":pep:`343` - The \" with\" statement"
3350- msgstr ""
3353+ msgstr ":pep:`343` - \" with \" 语句 "
33513354
33523355#: ../../reference/datamodel.rst:2464
33533356msgid ""
33543357"The specification, background, and examples for the Python :keyword:`with` "
33553358"statement."
3356- msgstr ""
3359+ msgstr "Python :keyword:`with` 语句的规范描述、背景和示例。 "
33573360
33583361#: ../../reference/datamodel.rst:2471
33593362msgid "Special method lookup"
3360- msgstr ""
3363+ msgstr "特殊方法查找 "
33613364
33623365#: ../../reference/datamodel.rst:2473
33633366msgid ""
@@ -3366,6 +3369,8 @@ msgid ""
33663369"object's instance dictionary. That behaviour is the reason why the "
33673370"following code raises an exception::"
33683371msgstr ""
3372+ "对于自定义类来说,特殊方法的隐式发起调用仅保证在其定义于对象类型中时能正确地发挥作用,而不能定义在对象实例字典中。 "
3373+ "该行为就是以下代码会引发异常的原因。::"
33693374
33703375#: ../../reference/datamodel.rst:2488
33713376msgid ""
@@ -3375,20 +3380,23 @@ msgid ""
33753380"used the conventional lookup process, they would fail when invoked on the "
33763381"type object itself::"
33773382msgstr ""
3383+ "此行为背后的原理在于包括类型对象在内的所有对象都会实现的几个特殊方法,例如 :meth:`__hash__` 和 :meth:`__repr__`。 "
3384+ "如果这些方法的隐式查找使用了传统的查找过程,它们会在对类型对象本身发起调用时失败::"
33783385
33793386#: ../../reference/datamodel.rst:2501
33803387msgid ""
33813388"Incorrectly attempting to invoke an unbound method of a class in this way is"
33823389" sometimes referred to as 'metaclass confusion', and is avoided by bypassing"
33833390" the instance when looking up special methods::"
3384- msgstr ""
3391+ msgstr "以这种方式不正确地尝试发起调用一个类的未绑定方法有时被称为‘元类混淆’,可以通过在查找特殊方法时绕过实例的方式来避免:: "
33853392
33863393#: ../../reference/datamodel.rst:2510
33873394msgid ""
33883395"In addition to bypassing any instance attributes in the interest of "
33893396"correctness, implicit special method lookup generally also bypasses the "
33903397":meth:`__getattribute__` method even of the object's metaclass::"
33913398msgstr ""
3399+ "除了为了正确性而绕过任何实例属性之外,隐式特殊方法查找通常也会绕过 :meth:`__getattribute__` 方法,甚至包括对象的元类::"
33923400
33933401#: ../../reference/datamodel.rst:2536
33943402msgid ""
@@ -3398,14 +3406,17 @@ msgid ""
33983406"method *must* be set on the class object itself in order to be consistently "
33993407"invoked by the interpreter)."
34003408msgstr ""
3409+ "以这种方式绕过 :meth:`__getattribute__` "
3410+ "机制为解析器内部的速度优化提供了显著的空间,其代价则是牺牲了处理特殊方法时的一些灵活性(特殊方法 *必须* "
3411+ "设置在类对象本身上以便始终一致地由解释器发起调用)。"
34013412
34023413#: ../../reference/datamodel.rst:2547
34033414msgid "Coroutines"
34043415msgstr "协程"
34053416
34063417#: ../../reference/datamodel.rst:2551
34073418msgid "Awaitable Objects"
3408- msgstr ""
3419+ msgstr "可等待对象 "
34093420
34103421#: ../../reference/datamodel.rst:2553
34113422msgid ""
0 commit comments