@@ -33,6 +33,8 @@ msgid ""
3333"sense, and in conformance to Von Neumann's model of a \" stored program "
3434"computer,\" code is also represented by objects.)"
3535msgstr ""
36+ ":dfn:`对象` 是 Python 中对数据的抽象。Python 程序中的所有数据都是由对象或对象间关系来表示的。(从某种意义上说,按照冯·诺依曼的 "
37+ "\" 存储程序计算机\" 模型,代码本身也是由对象来表示的。)"
3638
3739#: ../../reference/datamodel.rst:35
3840msgid ""
@@ -42,10 +44,12 @@ msgid ""
4244"two objects; the :func:`id` function returns an integer representing its "
4345"identity."
4446msgstr ""
47+ "每个对象都有各自的编号、类型和值。一个对象被创建后,它的 *编号* 就绝不会改变;你可以将其理解为该对象在内存中的地址。 ':keyword:`is`'"
48+ " 运算符可以比较两个对象的编号是否相同;:func:`id` 函数能返回一个代表其编号的整型数。"
4549
4650#: ../../reference/datamodel.rst:42
4751msgid "For CPython, ``id(x)`` is the memory address where ``x`` is stored."
48- msgstr ""
52+ msgstr "在 CPython 中,``id(x)`` 就是存放 ``x`` 的内存的地址。 "
4953
5054#: ../../reference/datamodel.rst:44
5155msgid ""
@@ -55,6 +59,8 @@ msgid ""
5559" an object itself). Like its identity, an object's :dfn:`type` is also "
5660"unchangeable. [#]_"
5761msgstr ""
62+ "对象的类型决定该对象所支持的操作 (例如 \" 对象是否有长度属性?\" ) 并且定义了该类型的对象可能的取值。:func:`type` "
63+ "函数能返回一个对象的类型 (类型本身也是对象)。与编号一样,一个对象的 :dfn:`类型` 也是不可改变的。[#]_"
5864
5965#: ../../reference/datamodel.rst:50
6066msgid ""
@@ -69,6 +75,9 @@ msgid ""
6975"instance, numbers, strings and tuples are immutable, while dictionaries and "
7076"lists are mutable."
7177msgstr ""
78+ "有些对象的 *值* 可以改变。值可以改变的对象被称为 *可变的*;值不可以改变的对象就被称为 "
79+ "*不可变的*。(一个不可变容器对象如果包含对可变对象的引用,当后者的值改变时,前者的值也会改变;但是该容器仍属于不可变对象,因为它所包含的对象集是不会改变的。因此,不可变并不严格等同于值不能改变,实际含义要更微妙。)"
80+ " 一个对象的可变性是由其类型决定的;例如,数字、字符串和元组是不可变的,而字典和列表是可变的。"
7281
7382#: ../../reference/datamodel.rst:65
7483msgid ""
@@ -78,6 +87,8 @@ msgid ""
7887"implementation quality how garbage collection is implemented, as long as no "
7988"objects are collected that are still reachable."
8089msgstr ""
90+ "对象绝不会被显式地销毁;然而,当无法访问时它们可能会被作为垃圾回收。允许具体的实现推迟垃圾回收或完全省略此机制 --- "
91+ "如何实现垃圾回收是实现的质量问题,只要可访问的对象不会被回收即可。"
8192
8293#: ../../reference/datamodel.rst:73
8394msgid ""
@@ -90,6 +101,10 @@ msgid ""
90101"on immediate finalization of objects when they become unreachable (so you "
91102"should always close files explicitly)."
92103msgstr ""
104+ "CPython 目前使用带有 (可选) "
105+ "延迟检测循环链接垃圾的引用计数方案,会在对象不可访问时立即回收其中的大部分,但不保证回收包含循环引用的垃圾。请查看 :mod:`gc` "
106+ "模块的文档了解如何控制循环垃圾的收集相关信息。其他实现会有不同的行为方式,CPython 现有方式也可能改变。不要依赖不可访问对象的立即终结机制 "
107+ "(所以你应当总是显式地关闭文件)。"
93108
94109#: ../../reference/datamodel.rst:82
95110msgid ""
0 commit comments