Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 596bb5b

Browse files
[po] auto sync
1 parent df90832 commit 596bb5b

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

.stat.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"translation": "95.13%", "updated_at": "2024-06-03T06:47:07Z"}
1+
{"translation": "95.14%", "updated_at": "2024-06-03T15:47:10Z"}

whatsnew/2.2.po

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ msgid ""
100100
" there's lots of C code that expects a regular Python list and won't accept "
101101
"a :class:`~collections.UserList` instance."
102102
msgstr ""
103+
"很久以前,我写过一个网页,列出了 Python 设计中的一些缺陷。其中一个最显著的缺陷是无法对子类化用 C 实现的 Python "
104+
"类型。特别是,无法对子类化内置类型,因此你不能简单地对子类化列表,以便向其添加一个有用的方法。虽然 :mod:`!UserList` "
105+
"模块提供了一个支持所有列表方法的类并且可以进一步子类化,但有很多 C 代码期望的是一个普通的 Python 列表,不能接受 "
106+
":class:`~collections.UserList` 实例。"
103107

104108
#: ../../whatsnew/2.2.rst:61
105109
msgid ""
@@ -127,6 +131,8 @@ msgid ""
127131
"instead, making the resulting code simpler and faster. As a small side "
128132
"benefit, attributes can now have docstrings, too."
129133
msgstr ""
134+
"还可以通过使用一种称为 *属性* 的新机制,在访问或设置实例属性时自动调用方法。许多 :meth:`~object.__getattr__` "
135+
"的用法可以重写为使用属性,从而使代码更简单、更快速。作为一个小的额外好处,属性现在也可以有文档字符串。"
130136

131137
#: ../../whatsnew/2.2.rst:76
132138
msgid ""
@@ -197,6 +203,9 @@ msgid ""
197203
"types, has also been added so if no built-in type is suitable, you can just "
198204
"subclass :class:`object`::"
199205
msgstr ""
206+
"那么如何定义一个新式类呢?你可以通过继承一个现有的新式类来实现。大多数 Python "
207+
"内置类型,如整数、列表、字典,甚至文件,现在都是新式类。此外,还添加了一个名为 :class:`object` "
208+
"的新式类,它是所有内置类型的基类,因此如果没有合适的内置类型,你可以直接继承 :class:`object` 类:"
200209

201210
#: ../../whatsnew/2.2.rst:121
202211
msgid ""
@@ -206,6 +215,9 @@ msgid ""
206215
" :pep:`253` for the details --- but it's easier to just subclass "
207216
":class:`object`.)"
208217
msgstr ""
218+
"这意味着在 Python 2.2 中,不带任何基类的 :keyword:`class` 声明总是经典类。(实际上,你也可以通过设置一个名为 "
219+
":attr:`!__metaclass__` 的模块级变量来改变这一点——详见 :pep:`253` ——但更简单的方法是直接继承 "
220+
":class:`object`。)"
209221

210222
#: ../../whatsnew/2.2.rst:126
211223
msgid ""
@@ -214,13 +226,18 @@ msgid ""
214226
":func:`int`, :func:`float`, and :func:`str`. In 2.2, they aren't functions "
215227
"any more, but type objects that behave as factories when called. ::"
216228
msgstr ""
229+
"内置类型的类型对象在 Python 2.2 中作为内置对象提供,使用了一种巧妙的技巧命名。Python 一直有名为 "
230+
":func:`int`、:func:`float` 和 :func:`str` 的内置函数。在 Python 2.2 "
231+
"中,它们不再是函数,而是作为被调用时表现为工厂的类型对象。"
217232

218233
#: ../../whatsnew/2.2.rst:136
219234
msgid ""
220235
"To make the set of types complete, new type objects such as :func:`dict` and"
221236
" :func:`!file` have been added. Here's a more interesting example, adding a"
222237
" :meth:`!lock` method to file objects::"
223238
msgstr ""
239+
"为了使类型集合完整,Python 2.2 中还添加了新的类型对象,例如 :func:`dict` 和 "
240+
":func:`!file`。以下是一个更有趣的例子,向文件对象添加一个 :meth:`!lock` 方法:"
224241

225242
#: ../../whatsnew/2.2.rst:146
226243
msgid ""

0 commit comments

Comments
 (0)