@@ -11,7 +11,7 @@ msgid ""
11
11
msgstr ""
12
12
"Project-Id-Version : Python 3.12\n "
13
13
"Report-Msgid-Bugs-To : \n "
14
- "POT-Creation-Date : 2024-12-06 14:52+0000\n "
14
+ "POT-Creation-Date : 2024-12-27 14:52+0000\n "
15
15
"PO-Revision-Date : 2024-05-11 00:32+0000\n "
16
16
"
Last-Translator :
Rafael Fontenelle <[email protected] >, 2024\n "
17
17
"Language-Team : Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n "
@@ -1064,6 +1064,14 @@ msgid ""
1064
1064
" raise\n"
1065
1065
" return type(obj).__getattr__(obj, name) # __getattr__"
1066
1066
msgstr ""
1067
+ "def getattr_hook(obj, name):\n"
1068
+ " \" Emulate slot_tp_getattr_hook() in Objects/typeobject.c\" \n"
1069
+ " try:\n"
1070
+ " return obj.__getattribute__(name)\n"
1071
+ " except AttributeError:\n"
1072
+ " if not hasattr(type(obj), '__getattr__'):\n"
1073
+ " raise\n"
1074
+ " return type(obj).__getattr__(obj, name) # __getattr__"
1067
1075
1068
1076
#: ../../howto/descriptor.rst:773
1069
1077
msgid "Invocation from a class"
@@ -1076,6 +1084,9 @@ msgid ""
1076
1084
":meth:`!object.__getattribute__` but the instance dictionary lookup is "
1077
1085
"replaced by a search through the class's :term:`method resolution order`."
1078
1086
msgstr ""
1087
+ "像 ``A.x`` 这样的点操作符查找的逻辑在 :meth:`!type.__getattribute__` 中。 其步骤与 "
1088
+ ":meth:`!object.__getattribute__` 相似,但是实例字典查找被替换为搜索类的 :term:`method "
1089
+ "resolution order`。"
1079
1090
1080
1091
#: ../../howto/descriptor.rst:780
1081
1092
msgid ""
@@ -1100,6 +1111,7 @@ msgid ""
1100
1111
":meth:`~object.__getattribute__` method for object returned by "
1101
1112
":func:`super`."
1102
1113
msgstr ""
1114
+ "super 的点操作符查找的逻辑在 :func:`super` 所返回对象的 :meth:`~object.__getattribute__` 方法中。"
1103
1115
1104
1116
#: ../../howto/descriptor.rst:792
1105
1117
msgid ""
@@ -1133,6 +1145,8 @@ msgid ""
1133
1145
":meth:`~object.__getattribute__` methods for :class:`object`, :class:`type`,"
1134
1146
" and :func:`super`."
1135
1147
msgstr ""
1148
+ "描述器的机制嵌入在 :class:`object`, :class:`type` 和 :func:`super` 的 "
1149
+ ":meth:`~object.__getattribute__` 方法中。"
1136
1150
1137
1151
#: ../../howto/descriptor.rst:809
1138
1152
msgid "The important points to remember are:"
@@ -1141,7 +1155,7 @@ msgstr "要记住的重要点是:"
1141
1155
#: ../../howto/descriptor.rst:811
1142
1156
msgid ""
1143
1157
"Descriptors are invoked by the :meth:`~object.__getattribute__` method."
1144
- msgstr ""
1158
+ msgstr "描述器将由 :meth:`~object.__getattribute__` 方法发起调用。 "
1145
1159
1146
1160
#: ../../howto/descriptor.rst:813
1147
1161
msgid ""
@@ -1153,7 +1167,7 @@ msgstr "类从 :class:`object`,:class:`type` 或 :func:`super` 继承此机制
1153
1167
msgid ""
1154
1168
"Overriding :meth:`~object.__getattribute__` prevents automatic descriptor "
1155
1169
"calls because all the descriptor logic is in that method."
1156
- msgstr ""
1170
+ msgstr "重写 :meth:`~object.__getattribute__` 将阻止自动的描述器调用因为所有描述器逻辑都在该方法中。 "
1157
1171
1158
1172
#: ../../howto/descriptor.rst:819
1159
1173
msgid ""
@@ -1162,6 +1176,8 @@ msgid ""
1162
1176
" and may include the class. The second puts in ``None`` for the instance "
1163
1177
"and always includes the class."
1164
1178
msgstr ""
1179
+ ":meth:`!object.__getattribute__` 和 :meth:`!type.__getattribute__` 会用不同方式调用 "
1180
+ ":meth:`~object.__get__`。 第一个会包括实例并可能包括类 。第二个会将 ``None`` 作为实例并且总是包括类。"
1165
1181
1166
1182
#: ../../howto/descriptor.rst:824
1167
1183
msgid "Data descriptors always override instance dictionaries."
@@ -1495,7 +1511,7 @@ msgstr ""
1495
1511
msgid ""
1496
1512
"Either the built-in :func:`property` or our :func:`!Property` equivalent "
1497
1513
"would work in this example."
1498
- msgstr ""
1514
+ msgstr "在这个例子中内置的 :func:`property` 或我们的 :func:`!Property` 等价实现都是可以的。 "
1499
1515
1500
1516
#: ../../howto/descriptor.rst:1158
1501
1517
msgid "Functions and methods"
0 commit comments