@@ -2980,7 +2980,7 @@ msgstr "数组与指针"
29802980
29812981#: ../../library/ctypes.rst:2513
29822982msgid "Abstract base class for arrays."
2983- msgstr ""
2983+ msgstr "数组的抽象基类。 "
29842984
29852985#: ../../library/ctypes.rst:2515
29862986msgid ""
@@ -2991,33 +2991,36 @@ msgid ""
29912991"and slice accesses; for slice reads, the resulting object is *not* itself an"
29922992" :class:`Array`."
29932993msgstr ""
2994+ "创建实际数组类型的推荐方式是通过将任意 :mod:`ctypes` 类型与一个正整数相乘。 作为替代方式,你也可以子类化这个类型并定义 "
2995+ ":attr:`_length_` 和 :attr:`_type_` 类变量。 数组元素可使用标准的抽取和切片方式来读写;对于切片读取,结果对象本身 "
2996+ "*并非* 一个 :class:`Array`。"
29942997
29952998#: ../../library/ctypes.rst:2525
29962999msgid ""
29973000"A positive integer specifying the number of elements in the array. Out-of-"
29983001"range subscripts result in an :exc:`IndexError`. Will be returned by "
29993002":func:`len`."
3000- msgstr ""
3003+ msgstr "一个指明数组中元素数量的正整数。 超出范围的抽取会导致 :exc:`IndexError`。 该值将由 :func:`len` 返回。 "
30013004
30023005#: ../../library/ctypes.rst:2532
30033006msgid "Specifies the type of each element in the array."
3004- msgstr ""
3007+ msgstr "指明数组中每个元素的类型。 "
30053008
30063009#: ../../library/ctypes.rst:2535
30073010msgid ""
30083011"Array subclass constructors accept positional arguments, used to initialize "
30093012"the elements in order."
3010- msgstr ""
3013+ msgstr "Array 子类构造器可接受位置参数,用来按顺序初始化元素。 "
30113014
30123015#: ../../library/ctypes.rst:2541
30133016msgid "Private, abstract base class for pointers."
3014- msgstr ""
3017+ msgstr "私有对象,指针的抽象基类。 "
30153018
30163019#: ../../library/ctypes.rst:2543
30173020msgid ""
30183021"Concrete pointer types are created by calling :func:`POINTER` with the type "
30193022"that will be pointed to; this is done automatically by :func:`pointer`."
3020- msgstr ""
3023+ msgstr "实际的指针类型是通过调用 :func:`POINTER` 并附带其将指向的类型来创建的;这会由 :func:`pointer` 自动完成。 "
30213024
30223025#: ../../library/ctypes.rst:2547
30233026msgid ""
@@ -3027,13 +3030,16 @@ msgid ""
30273030" the memory *before* the pointer (as in C), and out-of-range subscripts will"
30283031" probably crash with an access violation (if you're lucky)."
30293032msgstr ""
3033+ "如果一个指针指向的是数组,则其元素可使用标准的抽取和切片方式来读写。 指针对象没有长度,因此 :func:`len` 将引发 "
3034+ ":exc:`TypeError`。 抽取负值将会从指针 *之前* 的内存中读取(与 C "
3035+ "一样),并且超出范围的抽取将可能因非法访问而导致崩溃(视你的运气而定)。"
30303036
30313037#: ../../library/ctypes.rst:2557
30323038msgid "Specifies the type pointed to."
3033- msgstr ""
3039+ msgstr "指明所指向的类型。 "
30343040
30353041#: ../../library/ctypes.rst:2561
30363042msgid ""
30373043"Returns the object to which to pointer points. Assigning to this attribute "
30383044"changes the pointer to point to the assigned object."
3039- msgstr ""
3045+ msgstr "返回指针所指向的对象。 对此属性赋值会使指针改为指向所赋值的对象。 "
0 commit comments