-
-
Notifications
You must be signed in to change notification settings - Fork 80
/
Copy pathextending.po
452 lines (392 loc) · 22 KB
/
extending.po
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001-2021, Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# ppcfish <ppcfish@gmail.com>, 2019
# Freesand Leo <yuqinju@163.com>, 2019
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.7\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-01 16:02+0000\n"
"PO-Revision-Date: 2019-09-01 02:43+0000\n"
"Last-Translator: Freesand Leo <yuqinju@163.com>, 2019\n"
"Language-Team: Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: zh_CN\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: ../../faq/extending.rst:3
msgid "Extending/Embedding FAQ"
msgstr "扩展/嵌入常见问题"
#: ../../faq/extending.rst:6
msgid "Contents"
msgstr "目录"
#: ../../faq/extending.rst:16
msgid "Can I create my own functions in C?"
msgstr "可以使用C语言中创建自己的函数吗?"
#: ../../faq/extending.rst:18
msgid ""
"Yes, you can create built-in modules containing functions, variables, "
"exceptions and even new types in C. This is explained in the document "
":ref:`extending-index`."
msgstr "是的,您可以在C中创建包含函数、变量、异常甚至新类型的内置模块。在文档 :ref:`extending-index` 中有说明。"
#: ../../faq/extending.rst:22
msgid "Most intermediate or advanced Python books will also cover this topic."
msgstr "大多数中级或高级的Python书籍也涵盖这个主题。"
#: ../../faq/extending.rst:26
msgid "Can I create my own functions in C++?"
msgstr "可以使用C++语言中创建自己的函数吗?"
#: ../../faq/extending.rst:28
msgid ""
"Yes, using the C compatibility features found in C++. Place ``extern \"C\" "
"{ ... }`` around the Python include files and put ``extern \"C\"`` before "
"each function that is going to be called by the Python interpreter. Global "
"or static C++ objects with constructors are probably not a good idea."
msgstr ""
"是的,可以使用C ++中兼容C的功能。 在Python include文件周围放置` `extern“C”{...}`` "
",并在Python解释器调用的每个函数之前放置 ``extern“C”`` 。 具有构造函数的全局或静态C ++对象可能不是一个好主意。"
#: ../../faq/extending.rst:37
msgid "Writing C is hard; are there any alternatives?"
msgstr "C很难写,有没有其他选择?"
#: ../../faq/extending.rst:39
msgid ""
"There are a number of alternatives to writing your own C extensions, "
"depending on what you're trying to do."
msgstr "编写自己的C扩展有很多选择,具体取决于您要做的事情。"
#: ../../faq/extending.rst:44
msgid ""
"`Cython <http://cython.org>`_ and its relative `Pyrex "
"<https://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/>`_ are compilers"
" that accept a slightly modified form of Python and generate the "
"corresponding C code. Cython and Pyrex make it possible to write an "
"extension without having to learn Python's C API."
msgstr ""
"`Cython <http://cython.org>`_ 及其相关的 `Pyrex "
"<https://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/>`_ "
"是接受稍微修改过的Python形式并生成相应C代码的编译器。 Cython和Pyrex可以编写扩展而无需学习Python的C API。"
#: ../../faq/extending.rst:50
msgid ""
"If you need to interface to some C or C++ library for which no Python "
"extension currently exists, you can try wrapping the library's data types "
"and functions with a tool such as `SWIG <http://www.swig.org>`_. `SIP "
"<https://riverbankcomputing.com/software/sip/intro>`__, `CXX "
"<http://cxx.sourceforge.net/>`_ `Boost "
"<http://www.boost.org/libs/python/doc/index.html>`_, or `Weave "
"<https://github.com/scipy/weave>`_ are also alternatives for wrapping C++ "
"libraries."
msgstr ""
"如果需要连接到某些当前不存在Python扩展的C或C ++库,可以尝试使用 `SWIG <http://www.swig.org>`_ "
"等工具包装库的数据类型和函数。 `SIP <https://riverbankcomputing.com/software/sip/intro>`__"
" , `CXX <http://cxx.sourceforge.net/>`_ `Boost "
"<http://www.boost.org/libs/python/doc/index.html>`_ , 或 `Weave "
"<https://github.com/scipy/weave>`_ 也是包装C ++库的替代方案。"
#: ../../faq/extending.rst:61
msgid "How can I execute arbitrary Python statements from C?"
msgstr "如何在 C 中执行任意 Python 语句?"
#: ../../faq/extending.rst:63
msgid ""
"The highest-level function to do this is :c:func:`PyRun_SimpleString` which "
"takes a single string argument to be executed in the context of the module "
"``__main__`` and returns ``0`` for success and ``-1`` when an exception "
"occurred (including :exc:`SyntaxError`). If you want more control, use "
":c:func:`PyRun_String`; see the source for :c:func:`PyRun_SimpleString` in "
"``Python/pythonrun.c``."
msgstr ""
"执行此操作的最高层级函数为 :c:func:`PyRun_SimpleString`,它接受单个字符串参数用于在模块 ``__main__`` "
"的上下文中执行并在成功时返回 ``0`` 而在发生异常 (包括 :exc:`SyntaxError`) 时返回 ``-1``。 "
"如果你想要更多可控性,可以使用 :c:func:`PyRun_String`;请在 ``Python/pythonrun.c`` 中查看 "
":c:func:`PyRun_SimpleString` 的源码。"
#: ../../faq/extending.rst:72
msgid "How can I evaluate an arbitrary Python expression from C?"
msgstr "如何在 C 中对任意 Python 表达式求值?"
#: ../../faq/extending.rst:74
msgid ""
"Call the function :c:func:`PyRun_String` from the previous question with the"
" start symbol :c:data:`Py_eval_input`; it parses an expression, evaluates it"
" and returns its value."
msgstr ""
"可以调用前一问题中介绍的函数 :c:func:`PyRun_String` 并附带起始标记符 "
":c:data:`Py_eval_input`;它会解析表达式,对其求值并返回结果值。"
#: ../../faq/extending.rst:80
msgid "How do I extract C values from a Python object?"
msgstr "如何从Python对象中提取C的值?"
#: ../../faq/extending.rst:82
msgid ""
"That depends on the object's type. If it's a tuple, :c:func:`PyTuple_Size` "
"returns its length and :c:func:`PyTuple_GetItem` returns the item at a "
"specified index. Lists have similar functions, :c:func:`PyListSize` and "
":c:func:`PyList_GetItem`."
msgstr ""
"这取决于对象的类型。 如果是元组,:c:func:`PyTuple_Size` 可返回其长度而 :c:func:`PyTuple_GetItem` "
"可返回指定序号上的项。 对于列表也有类似的函数 :c:func:`PyListSize` 和 :c:func:`PyList_GetItem`。"
#: ../../faq/extending.rst:87
msgid ""
"For bytes, :c:func:`PyBytes_Size` returns its length and "
":c:func:`PyBytes_AsStringAndSize` provides a pointer to its value and its "
"length. Note that Python bytes objects may contain null bytes so C's "
":c:func:`strlen` should not be used."
msgstr ""
"对于字节串,:c:func:`PyBytes_Size` 可返回其长度而 :c:func:`PyBytes_AsStringAndSize` "
"提供一个指向其值和长度的指针。 请注意 Python 字节串可能为空,因此 C 的 :c:func:`strlen` 不应被使用。"
#: ../../faq/extending.rst:92
msgid ""
"To test the type of an object, first make sure it isn't ``NULL``, and then "
"use :c:func:`PyBytes_Check`, :c:func:`PyTuple_Check`, "
":c:func:`PyList_Check`, etc."
msgstr ""
"要检测一个对象的类型,首先要确保它不为 ``NULL``,然后使用 :c:func:`PyBytes_Check`, "
":c:func:`PyTuple_Check`, :c:func:`PyList_Check` 等等。"
#: ../../faq/extending.rst:95
msgid ""
"There is also a high-level API to Python objects which is provided by the "
"so-called 'abstract' interface -- read ``Include/abstract.h`` for further "
"details. It allows interfacing with any kind of Python sequence using calls"
" like :c:func:`PySequence_Length`, :c:func:`PySequence_GetItem`, etc. as "
"well as many other useful protocols such as numbers "
"(:c:func:`PyNumber_Index` et al.) and mappings in the PyMapping APIs."
msgstr ""
"还有一个针对 Python 对象的高层级 API,通过所谓的‘抽象’接口提供 —— 请参阅 ``Include/abstract.h`` 了解详情。 "
"它允许使用 :c:func:`PySequence_Length`, :c:func:`PySequence_GetItem` 这样的调用来与任意种类的"
" Python 序列进行对接,此外还可使用许多其他有用的协议例如数字 (:c:func:`PyNumber_Index` 等) 以及 PyMapping"
" API 中的各种映射等等。"
#: ../../faq/extending.rst:104
msgid "How do I use Py_BuildValue() to create a tuple of arbitrary length?"
msgstr "如何使用Py_BuildValue()创建任意长度的元组?"
#: ../../faq/extending.rst:106
msgid "You can't. Use :c:func:`PyTuple_Pack` instead."
msgstr "不可以。应该使用 :c:func:`PyTuple_Pack` 。"
#: ../../faq/extending.rst:110
msgid "How do I call an object's method from C?"
msgstr "如何从C调用对象的方法?"
#: ../../faq/extending.rst:112
msgid ""
"The :c:func:`PyObject_CallMethod` function can be used to call an arbitrary "
"method of an object. The parameters are the object, the name of the method "
"to call, a format string like that used with :c:func:`Py_BuildValue`, and "
"the argument values::"
msgstr ""
"可以使用 :c:func:`PyObject_CallMethod` 函数来调用某个对象的任意方法。 形参为该对象、要调用的方法名、类似 "
":c:func:`Py_BuildValue` 所用的格式字符串以及要传给方法的参数值::"
#: ../../faq/extending.rst:121
msgid ""
"This works for any object that has methods -- whether built-in or user-"
"defined. You are responsible for eventually :c:func:`Py_DECREF`\\ 'ing the "
"return value."
msgstr ""
"这适用于任何具有方法的对象 —— 不论是内置方法还是用户自定义方法。 你需要负责对返回值进行最终的 :c:func:`Py_DECREF` 处理。"
#: ../../faq/extending.rst:124
msgid ""
"To call, e.g., a file object's \"seek\" method with arguments 10, 0 "
"(assuming the file object pointer is \"f\")::"
msgstr "例如调用某个文件对象的 \"seek\" 方法并传入参数 10, 0 (假定文件对象的指针为 \"f\")::"
#: ../../faq/extending.rst:135
msgid ""
"Note that since :c:func:`PyObject_CallObject` *always* wants a tuple for the"
" argument list, to call a function without arguments, pass \"()\" for the "
"format, and to call a function with one argument, surround the argument in "
"parentheses, e.g. \"(i)\"."
msgstr ""
"请注意由于 :c:func:`PyObject_CallObject` *总是* 接受一个元组作为参数列表,要调用不带参数的函数,则传入格式为 "
"\"()\",要调用只带一个参数的函数,则应将参数包含于圆括号中,例如 \"(i)\"。"
#: ../../faq/extending.rst:142
msgid ""
"How do I catch the output from PyErr_Print() (or anything that prints to "
"stdout/stderr)?"
msgstr "如何捕获PyErr_Print()(或打印到stdout / stderr的任何内容)的输出?"
#: ../../faq/extending.rst:144
msgid ""
"In Python code, define an object that supports the ``write()`` method. "
"Assign this object to :data:`sys.stdout` and :data:`sys.stderr`. Call "
"print_error, or just allow the standard traceback mechanism to work. Then, "
"the output will go wherever your ``write()`` method sends it."
msgstr ""
"在 Python 代码中,定义一个支持 ``write()`` 方法的对象。 将此对象赋值给 :data:`sys.stdout` 和 "
":data:`sys.stderr`。 调用 print_error 或者只是允许标准回溯机制生效。 在此之后,输出将转往你的 ``write()`` "
"方法所指向的任何地方。"
#: ../../faq/extending.rst:149
msgid "The easiest way to do this is to use the :class:`io.StringIO` class:"
msgstr "做到这一点的最简单方式是使用 :class:`io.StringIO` 类:"
#: ../../faq/extending.rst:161
msgid "A custom object to do the same would look like this:"
msgstr "实现同样效果的自定义对象看起来是这样的:"
#: ../../faq/extending.rst:182
msgid "How do I access a module written in Python from C?"
msgstr "如何从C访问用Python编写的模块?"
#: ../../faq/extending.rst:184
msgid "You can get a pointer to the module object as follows::"
msgstr "你可以通过如下方式获得一个指向模块对象的指针::"
#: ../../faq/extending.rst:188
msgid ""
"If the module hasn't been imported yet (i.e. it is not yet present in "
":data:`sys.modules`), this initializes the module; otherwise it simply "
"returns the value of ``sys.modules[\"<modulename>\"]``. Note that it "
"doesn't enter the module into any namespace -- it only ensures it has been "
"initialized and is stored in :data:`sys.modules`."
msgstr ""
"如果模块尚未被导入(即它还不存在于 :data:`sys.modules` 中),这会初始化该模块;否则它只是简单地返回 "
"``sys.modules[\"<modulename>\"]`` 的值。 请注意它并不会将模块加入任何命名空间 —— 它只是确保模块被初始化并存在于 "
":data:`sys.modules` 中。"
#: ../../faq/extending.rst:194
msgid ""
"You can then access the module's attributes (i.e. any name defined in the "
"module) as follows::"
msgstr "之后你就可以通过如下方式来访问模块的属性(即模块中定义的任何名称)::"
#: ../../faq/extending.rst:199
msgid ""
"Calling :c:func:`PyObject_SetAttrString` to assign to variables in the "
"module also works."
msgstr "调用 :c:func:`PyObject_SetAttrString` 为模块中的变量赋值也是可以的。"
#: ../../faq/extending.rst:204
msgid "How do I interface to C++ objects from Python?"
msgstr "如何在 Python 中对接 C ++ 对象?"
#: ../../faq/extending.rst:206
msgid ""
"Depending on your requirements, there are many approaches. To do this "
"manually, begin by reading :ref:`the \"Extending and Embedding\" document "
"<extending-index>`. Realize that for the Python run-time system, there "
"isn't a whole lot of difference between C and C++ -- so the strategy of "
"building a new Python type around a C structure (pointer) type will also "
"work for C++ objects."
msgstr ""
"根据你的需求,可以选择许多方式。 手动的实现方式请查阅 :ref:`\"扩展与嵌入\" 文档 <extending-index>` 来入门。 "
"需要知道的是对于 Python 运行时系统来说,C 和 C++ 并不没有太大的区别 —— 因此围绕一个 C 结构(指针)类型构建新 Python "
"对象的策略同样适用于 C++ 对象。"
#: ../../faq/extending.rst:212
msgid "For C++ libraries, see :ref:`c-wrapper-software`."
msgstr "有关C ++库,请参阅 :ref:`c-wrapper-software` "
#: ../../faq/extending.rst:216
msgid "I added a module using the Setup file and the make fails; why?"
msgstr "我使用Setup文件添加了一个模块,为什么make失败了?"
#: ../../faq/extending.rst:218
msgid ""
"Setup must end in a newline, if there is no newline there, the build process"
" fails. (Fixing this requires some ugly shell script hackery, and this bug "
"is so minor that it doesn't seem worth the effort.)"
msgstr ""
"安装程序必须以换行符结束,如果没有换行符,则构建过程将失败。 "
"(修复这个需要一些丑陋的shell脚本编程,而且这个bug很小,看起来不值得花这么大力气。)"
#: ../../faq/extending.rst:224
msgid "How do I debug an extension?"
msgstr "如何调试扩展?"
#: ../../faq/extending.rst:226
msgid ""
"When using GDB with dynamically loaded extensions, you can't set a "
"breakpoint in your extension until your extension is loaded."
msgstr "将GDB与动态加载的扩展名一起使用时,在加载扩展名之前,不能在扩展名中设置断点。"
#: ../../faq/extending.rst:229
msgid "In your ``.gdbinit`` file (or interactively), add the command:"
msgstr "在您的 ``.gdbinit`` 文件中(或交互式)添加命令:"
#: ../../faq/extending.rst:235
msgid "Then, when you run GDB:"
msgstr "然后运行GDB:"
#: ../../faq/extending.rst:247
msgid ""
"I want to compile a Python module on my Linux system, but some files are "
"missing. Why?"
msgstr "我想在Linux系统上编译一个Python模块,但是缺少一些文件。为什么?"
#: ../../faq/extending.rst:249
msgid ""
"Most packaged versions of Python don't include the "
":file:`/usr/lib/python2.{x}/config/` directory, which contains various files"
" required for compiling Python extensions."
msgstr ""
"大多数打包的Python版本不包含 :file:`/usr/lib/python2.{x}/config/` "
"目录,该目录中包含编译Python扩展所需的各种文件。"
#: ../../faq/extending.rst:253
msgid "For Red Hat, install the python-devel RPM to get the necessary files."
msgstr "对于Red Hat,安装python-devel RPM以获取必要的文件。"
#: ../../faq/extending.rst:255
msgid "For Debian, run ``apt-get install python-dev``."
msgstr "对于Debian,运行 ``apt-get install python-dev`` 。"
#: ../../faq/extending.rst:259
msgid "How do I tell \"incomplete input\" from \"invalid input\"?"
msgstr "如何区分“输入不完整”和“输入无效”?"
#: ../../faq/extending.rst:261
msgid ""
"Sometimes you want to emulate the Python interactive interpreter's behavior,"
" where it gives you a continuation prompt when the input is incomplete (e.g."
" you typed the start of an \"if\" statement or you didn't close your "
"parentheses or triple string quotes), but it gives you a syntax error "
"message immediately when the input is invalid."
msgstr ""
"有时,希望模仿Python交互式解释器的行为,在输入不完整时(例如,您键入了“if”语句的开头,或者没有关闭括号或三个字符串引号),给出一个延续提示,但当输入无效时,立即给出一条语法错误消息。"
#: ../../faq/extending.rst:267
msgid ""
"In Python you can use the :mod:`codeop` module, which approximates the "
"parser's behavior sufficiently. IDLE uses this, for example."
msgstr "在Python中,您可以使用 :mod:`codeop` 模块,该模块非常接近解析器的行为。例如,IDLE就使用了这个。"
#: ../../faq/extending.rst:270
msgid ""
"The easiest way to do it in C is to call :c:func:`PyRun_InteractiveLoop` "
"(perhaps in a separate thread) and let the Python interpreter handle the "
"input for you. You can also set the :c:func:`PyOS_ReadlineFunctionPointer` "
"to point at your custom input function. See ``Modules/readline.c`` and "
"``Parser/myreadline.c`` for more hints."
msgstr ""
"在C中执行此操作的最简单方法是调用 :c:func:`PyRun_InteractiveLoop` "
"(可能在单独的线程中)并让Python解释器为您处理输入。您还可以设置 :c:func:`PyOS_ReadlineFunctionPointer` "
"指向您的自定义输入函数。有关更多提示,请参阅 ``Modules/readline.c`` 和 ``Parser/myreadline.c`` 。"
#: ../../faq/extending.rst:276
msgid ""
"However sometimes you have to run the embedded Python interpreter in the "
"same thread as your rest application and you can't allow the "
":c:func:`PyRun_InteractiveLoop` to stop while waiting for user input. The "
"one solution then is to call :c:func:`PyParser_ParseString` and test for "
"``e.error`` equal to ``E_EOF``, which means the input is incomplete. Here's"
" a sample code fragment, untested, inspired by code from Alex Farber::"
msgstr ""
"但是,有时必须在与其他应用程序相同的线程中运行嵌入式Python解释器,并且不能允许 :c:func:`PyRun_InteractiveLoop` "
"在等待用户输入时停止。那么另一个解决方案是调用 :c:func:`PyParser_ParseString` 并测试 ``e.error`` 等于 "
"``E_EOF`` ,如果等于,就意味着输入不完整。这是一个示例代码片段,未经测试,灵感来自Alex Farber的代码::"
#: ../../faq/extending.rst:310
msgid ""
"Another solution is trying to compile the received string with "
":c:func:`Py_CompileString`. If it compiles without errors, try to execute "
"the returned code object by calling :c:func:`PyEval_EvalCode`. Otherwise "
"save the input for later. If the compilation fails, find out if it's an "
"error or just more input is required - by extracting the message string from"
" the exception tuple and comparing it to the string \"unexpected EOF while "
"parsing\". Here is a complete example using the GNU readline library (you "
"may want to ignore **SIGINT** while calling readline())::"
msgstr ""
"另一个解决方案是尝试使用 :c:func:`Py_CompileString` 编译接收到的字符串。如果编译时没有出现错误,请尝试通过调用 "
":c:func:`PyEval_EvalCode` 来执行返回的代码对象。否则,请将输入保存到以后。如果编译失败,找出是错误还是只需要更多的输入-"
"从异常元组中提取消息字符串,并将其与字符串 “分析时意外的EOF” "
"进行比较。下面是使用GNUreadline库的完整示例(您可能希望在调用readline()时忽略 **SIGINT** ):"
#: ../../faq/extending.rst:432
msgid "How do I find undefined g++ symbols __builtin_new or __pure_virtual?"
msgstr "如何找到未定义的g++符号__builtin_new或__pure_virtual?"
#: ../../faq/extending.rst:434
msgid ""
"To dynamically load g++ extension modules, you must recompile Python, relink"
" it using g++ (change LINKCC in the Python Modules Makefile), and link your "
"extension module using g++ (e.g., ``g++ -shared -o mymodule.so "
"mymodule.o``)."
msgstr ""
"要动态加载g ++扩展模块,必须重新编译Python,要使用g ++重新链接(在Python Modules "
"Makefile中更改LINKCC),及链接扩展模块(例如: ``g++ -shared -o mymodule.so mymodule.o`` )。"
#: ../../faq/extending.rst:440
msgid ""
"Can I create an object class with some methods implemented in C and others "
"in Python (e.g. through inheritance)?"
msgstr "能否创建一个对象类,其中部分方法在C中实现,而其他方法在Python中实现(例如通过继承)?"
#: ../../faq/extending.rst:442
msgid ""
"Yes, you can inherit from built-in classes such as :class:`int`, "
":class:`list`, :class:`dict`, etc."
msgstr "是的,您可以继承内置类,例如 :class:`int` , :class:`list` , :class:`dict` 等。"
#: ../../faq/extending.rst:445
msgid ""
"The Boost Python Library (BPL, "
"http://www.boost.org/libs/python/doc/index.html) provides a way of doing "
"this from C++ (i.e. you can inherit from an extension class written in C++ "
"using the BPL)."
msgstr ""
"Boost Python库(BPL,http://www.boost.org/libs/python/doc/index.html)提供了一种从C "
"++执行此操作的方法(即,您可以使用BPL继承自C ++编写的扩展类 )。"