1
- # SOME DESCRIPTIVE TITLE.
2
- # Copyright (C) 2001-2022, Python Software Foundation
1
+ # Copyright (C) 2001-2025, Python Software Foundation
3
2
# This file is distributed under the same license as the Python package.
4
3
#
5
4
# Translators:
5
+ # Matt Wang <mattwang44@gmail.com>, 2025
6
6
msgid ""
7
7
msgstr ""
8
8
"Project-Id-Version : Python 3.13\n "
9
9
"Report-Msgid-Bugs-To : \n "
10
10
"POT-Creation-Date : 2025-06-27 07:36+0000\n "
11
- "PO-Revision-Date : 2018-05-23 14:40+0000\n "
12
- "Last-Translator : Adrian Liaw <adrianliaw2000 @gmail.com>\n "
11
+ "PO-Revision-Date : 2025-07-13 14:40+0000\n "
12
+ "Last-Translator : Matt Wang <mattwang44 @gmail.com>\n "
13
13
"Language-Team : Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
14
14
"tw)\n "
15
15
"Language : zh_TW\n "
@@ -32,6 +32,8 @@ msgid ""
32
32
"in Python. Two classes and convenience functions are included which can be "
33
33
"used to build applications which provide an interactive interpreter prompt."
34
34
msgstr ""
35
+ "``code`` 模組提供在 Python 中實作讀取-求值-印出迴圈(read-eval-print loops)的"
36
+ "設施。包含兩個類別和便利函式,可用於建立提供互動式直譯器提示的應用程式。"
35
37
36
38
#: ../../library/code.rst:18
37
39
msgid ""
@@ -42,6 +44,10 @@ msgid ""
42
44
"it defaults to a newly created dictionary with key ``'__name__'`` set to "
43
45
"``'__console__'`` and key ``'__doc__'`` set to ``None``."
44
46
msgstr ""
47
+ "這個類別處理剖析和直譯器狀態(使用者的命名空間);它不處理輸入緩衝、提示或輸"
48
+ "入檔案命名(檔案名稱總是明確傳入)。可選的 *locals* 引數指定一個對映,作為執"
49
+ "行程式碼的命名空間;它預設為新建立的字典,鍵 ``'__name__'`` 設為 "
50
+ "``'__console__'`` 而鍵 ``'__doc__'`` 會設為 ``None``。"
45
51
46
52
#: ../../library/code.rst:25
47
53
msgid ""
@@ -50,6 +56,9 @@ msgid ""
50
56
"*locals*. They are only pickleable if *locals* is the namespace of an "
51
57
"existing module."
52
58
msgstr ""
59
+ "請注意,在 :class:`!InteractiveInterpreter` 實例下建立的函式和類別物件將屬於"
60
+ "由 *locals* 指定的命名空間。只有當 *locals* 是現有模組的命名空間時,它們才會"
61
+ "是可被 pickle 的。"
53
62
54
63
#: ../../library/code.rst:34
55
64
msgid ""
@@ -59,6 +68,10 @@ msgid ""
59
68
"is true, ``exit()`` and ``quit()`` in the console will not raise :exc:"
60
69
"`SystemExit`, but instead return to the calling code."
61
70
msgstr ""
71
+ "近似地模擬出互動式 Python 直譯器的行為。這個類別建立"
72
+ "在 :class:`InteractiveInterpreter` 的基礎上,並加入使用熟悉的 ``sys.ps1`` 和 "
73
+ "``sys.ps2`` 的提示,以及輸入緩衝。如果 *local_exit* 為 true,控制台中的 "
74
+ "``exit()`` 和 ``quit()`` 將不會引發 :exc:`SystemExit`,而是回傳到呼叫程式碼。"
62
75
63
76
#: ../../library/code.rst:40 ../../library/code.rst:58
64
77
msgid "Added *local_exit* parameter."
@@ -76,12 +89,20 @@ msgid ""
76
89
"*banner* and *exitmsg* passed as the banner and exit message to use, if "
77
90
"provided. The console object is discarded after use."
78
91
msgstr ""
92
+ "執行 read-eval-print 迴圈的便利函式。這會建立一"
93
+ "個 :class:`InteractiveConsole` 的新實例,並設定 *readfunc* 以用"
94
+ "於 :meth:`InteractiveConsole.raw_input` 方法(如有提供)。如果 *local* 有被提"
95
+ "供,它會被傳給 :class:`InteractiveConsole` 的建構函式以作為直譯器迴圈的預設命"
96
+ "名空間。如果有提供 *local_exit*,它會被傳給 :class:`InteractiveConsole` 構建"
97
+ "函式。然後實例的 :meth:`~InteractiveConsole.interact` 方法會執行,並傳入 "
98
+ "*banner* 和 *exitmsg* 以作為要使用的橫幅和退出訊息(如有提供)。控制台物件在"
99
+ "使用後就會被丟棄。"
79
100
80
101
#: ../../library/code.rst:55
81
102
msgid "Added *exitmsg* parameter."
82
103
msgstr "新增 *exitmsg* 參數。"
83
104
84
- #: ../../library/code.rst:63
105
+ #: ../../library/code.rst:57
85
106
msgid ""
86
107
"This function is useful for programs that want to emulate Python's "
87
108
"interpreter main loop (a.k.a. the read-eval-print loop). The tricky part is "
@@ -90,6 +111,10 @@ msgid ""
90
111
"syntax error). This function *almost* always makes the same decision as the "
91
112
"real interpreter main loop."
92
113
msgstr ""
114
+ "這個函式對於想要模擬 Python 的直譯器主迴圈(即讀取-求值-印出迴圈)的程式很有"
115
+ "用。最棘手的部分是判斷使用者何時輸入了一個不完整的命令,而這個命令可以透過輸"
116
+ "入更多文字來完成(相對於完整的命令或語法錯誤)。這個函式\\ *幾乎*\\ 總是做出"
117
+ "與真正的直譯器主迴圈相同的判斷。"
93
118
94
119
#: ../../library/code.rst:70
95
120
msgid ""
@@ -98,6 +123,9 @@ msgid ""
98
123
"optional grammar start symbol, which should be ``'single'`` (the default), "
99
124
"``'eval'`` or ``'exec'``."
100
125
msgstr ""
126
+ "*source* 是來源字串;*filename* 是讀取來源的可選檔案名稱,預設為 "
127
+ "``'<input>'``;*symbol* 是可選的文法 (grammar) 起始符號,其應為 "
128
+ "``'single'``\\ (預設值)、``'eval'`` 或 ``'exec'``。"
101
129
102
130
#: ../../library/code.rst:75
103
131
msgid ""
@@ -107,17 +135,24 @@ msgid ""
107
135
"error, or raises :exc:`OverflowError` or :exc:`ValueError` if the command "
108
136
"contains an invalid literal."
109
137
msgstr ""
138
+ "如果命令完整且有效,則回傳程式碼物件(與 ``compile(source,filename,symbol)`` "
139
+ "相同);如果命令不完整,則回傳 ``None``;如果命令完整但包含語法錯誤,則引"
140
+ "發 :exc:`SyntaxError`,如果命令包含無效的字面值 (literal),則引"
141
+ "發 :exc:`OverflowError` 或 :exc:`ValueError`。"
110
142
111
143
#: ../../library/code.rst:85
112
144
msgid "Interactive Interpreter Objects"
113
- msgstr ""
145
+ msgstr "互動式直譯器物件 "
114
146
115
147
#: ../../library/code.rst:90
116
148
msgid ""
117
149
"Compile and run some source in the interpreter. Arguments are the same as "
118
150
"for :func:`compile_command`; the default for *filename* is ``'<input>'``, "
119
151
"and for *symbol* is ``'single'``. One of several things can happen:"
120
152
msgstr ""
153
+ "在直譯器中編譯並執行某些原始碼。引數與 :func:`compile_command` 相同;"
154
+ "*filename* 的預設值是 ``'<input>'``,*symbol* 的預設值是 ``'single'``。有幾種"
155
+ "情況會發生:"
121
156
122
157
#: ../../library/code.rst:94
123
158
msgid ""
@@ -126,12 +161,17 @@ msgid ""
126
161
"by calling the :meth:`showsyntaxerror` method. :meth:`runsource` returns "
127
162
"``False``."
128
163
msgstr ""
164
+ "輸入不正確;:func:`compile_command` 會引發例外(:exc:`SyntaxError` "
165
+ "或 :exc:`OverflowError`)。語法回溯 (syntax traceback) 會透過呼"
166
+ "叫 :meth:`showsyntaxerror` 方法來印出。:meth:`runsource` 會回傳 ``False``。"
129
167
130
168
#: ../../library/code.rst:99
131
169
msgid ""
132
170
"The input is incomplete, and more input is required; :func:`compile_command` "
133
171
"returned ``None``. :meth:`runsource` returns ``True``."
134
172
msgstr ""
173
+ "輸入不完整,需要更多輸入;:func:`compile_command` 回傳了 "
174
+ "``None``。:meth:`runsource` 會回傳 ``True``。"
135
175
136
176
#: ../../library/code.rst:102
137
177
msgid ""
@@ -140,68 +180,90 @@ msgid ""
140
180
"exceptions, except for :exc:`SystemExit`). :meth:`runsource` returns "
141
181
"``False``."
142
182
msgstr ""
183
+ "輸入完整;:func:`compile_command` 回傳一個程式碼物件。程式碼會透過呼"
184
+ "叫 :meth:`runcode` 執行(它也會處理執行時的例外,除 :exc:`SystemExit` 以"
185
+ "外)。:meth:`runsource` 會回傳 ``False``。"
186
+
187
+ #: ../../library/code.rst:100
188
+ msgid ""
189
+ "The return value can be used to decide whether to use ``sys.ps1`` or "
190
+ "``sys.ps2`` to prompt the next line."
191
+ msgstr "回傳值可用來決定是使用 ``sys.ps1`` 還是 ``sys.ps2`` 以提示下一列。"
143
192
144
193
#: ../../library/code.rst:106
145
194
msgid ""
146
195
"The return value can be used to decide whether to use ``sys.ps1`` or ``sys."
147
196
"ps2`` to prompt the next line."
148
- msgstr ""
197
+ msgstr "回傳值可用來決定是使用 ``sys.ps1`` 還是 ``sys.ps2`` 以提示下一列。 "
149
198
150
199
#: ../../library/code.rst:112
151
200
msgid ""
152
201
"Execute a code object. When an exception occurs, :meth:`showtraceback` is "
153
202
"called to display a traceback. All exceptions are caught except :exc:"
154
203
"`SystemExit`, which is allowed to propagate."
155
204
msgstr ""
205
+ "執行程式碼物件。當例外發生時,會呼叫 :meth:`showtraceback` 來顯示回溯。除"
206
+ "了 :exc:`SystemExit` 允許繼續傳播之外,所有的例外都會被捕獲。"
156
207
157
208
#: ../../library/code.rst:116
158
209
msgid ""
159
210
"A note about :exc:`KeyboardInterrupt`: this exception may occur elsewhere in "
160
211
"this code, and may not always be caught. The caller should be prepared to "
161
212
"deal with it."
162
213
msgstr ""
214
+ "關於 :exc:`KeyboardInterrupt` 的注意事項:此例外可能發生在此程式碼的其他地"
215
+ "方,而且不一定會被捕獲到。呼叫者應該準備好處理它。"
163
216
164
- #: ../../library/code.rst:123
217
+ #: ../../library/code.rst:117
165
218
msgid ""
166
219
"Display the syntax error that just occurred. This does not display a stack "
167
220
"trace because there isn't one for syntax errors. If *filename* is given, it "
168
221
"is stuffed into the exception instead of the default filename provided by "
169
222
"Python's parser, because it always uses ``'<string>'`` when reading from a "
170
223
"string. The output is written by the :meth:`write` method."
171
224
msgstr ""
225
+ "顯示剛剛發生的語法錯誤。這不會顯示堆疊追蹤 (stack trace),因為語法錯誤沒有堆疊追蹤。"
226
+ "如果給出 *filename*,它會被塞入例外,而不是 Python 剖析器提供的預設檔案名稱,因為它"
227
+ "從字串讀取時總是使用 ``'<string>'``。輸出會由 :meth:`write` 方法寫入。"
172
228
173
- #: ../../library/code.rst:132
229
+ #: ../../library/code.rst:126
174
230
msgid ""
175
231
"Display the exception that just occurred. We remove the first stack item "
176
232
"because it is within the interpreter object implementation. The output is "
177
233
"written by the :meth:`write` method."
178
234
msgstr ""
235
+ "顯示剛剛發生的例外。我們移除第一個堆疊項目,因為它在直譯器物件的實作範圍內。"
236
+ "輸出由 :meth:`write` 方法寫入。"
179
237
180
- #: ../../library/code.rst:136
238
+ #: ../../library/code.rst:130
181
239
msgid ""
182
240
"The full chained traceback is displayed instead of just the primary "
183
241
"traceback."
184
- msgstr ""
242
+ msgstr "會顯示完整的連鎖回溯記錄,而不只是主要回溯。 "
185
243
186
244
#: ../../library/code.rst:142
187
245
msgid ""
188
246
"Write a string to the standard error stream (``sys.stderr``). Derived "
189
247
"classes should override this to provide the appropriate output handling as "
190
248
"needed."
191
249
msgstr ""
250
+ "寫入字串到標準錯誤串流 (``sys.stderr``)。衍生類別應覆寫此功能,以根據需求提供"
251
+ "適當的輸出處理。"
192
252
193
253
#: ../../library/code.rst:149
194
254
msgid "Interactive Console Objects"
195
- msgstr ""
255
+ msgstr "互動式控制台物件 "
196
256
197
- #: ../../library/code.rst:151
257
+ #: ../../library/code.rst:145
198
258
msgid ""
199
259
"The :class:`InteractiveConsole` class is a subclass of :class:"
200
260
"`InteractiveInterpreter`, and so offers all the methods of the interpreter "
201
261
"objects as well as the following additions."
202
262
msgstr ""
263
+ ":class:`InteractiveConsole` 類別是 :class:`InteractiveInterpreter` 的子類別,"
264
+ "因此提供了所有直譯器物件的方法以及下列新增的功能。"
203
265
204
- #: ../../library/code.rst:158
266
+ #: ../../library/code.rst:152
205
267
msgid ""
206
268
"Closely emulate the interactive Python console. The optional *banner* "
207
269
"argument specify the banner to print before the first interaction; by "
@@ -210,23 +272,28 @@ msgid ""
210
272
"(so as not to confuse this with the real interpreter -- since it's so "
211
273
"close!)."
212
274
msgstr ""
275
+ "近似地模擬互動式 Python 控制台。可選的 *banner* 引數指定在第一次互動之前要印"
276
+ "出的横幅;預設會印出類似標準 Python 直譯器所列印的横幅,接著是控制台物"
277
+ "件在括弧中的類別名稱 (以免與真正的直譯器混淆 -- 因為它是如此接近!)。"
213
278
214
- #: ../../library/code.rst:164
279
+ #: ../../library/code.rst:158
215
280
msgid ""
216
281
"The optional *exitmsg* argument specifies an exit message printed when "
217
282
"exiting. Pass the empty string to suppress the exit message. If *exitmsg* is "
218
283
"not given or ``None``, a default message is printed."
219
284
msgstr ""
285
+ "可選的 *exitmsg* 引數指定退出時列印的退出訊息。傳遞空字串以抑制退出訊息。如果"
286
+ "沒有給 *exitmsg* 或 ``None``,則會印出預設訊息。"
220
287
221
288
#: ../../library/code.rst:168
222
289
msgid "To suppress printing any banner, pass an empty string."
223
- msgstr ""
290
+ msgstr "若要抑制印出任何橫幅,請傳入空字串。 "
224
291
225
292
#: ../../library/code.rst:171
226
293
msgid "Print an exit message when exiting."
227
- msgstr ""
294
+ msgstr "退出時印出退出訊息。 "
228
295
229
- #: ../../library/code.rst:177
296
+ #: ../../library/code.rst:171
230
297
msgid ""
231
298
"Push a line of source text to the interpreter. The line should not have a "
232
299
"trailing newline; it may have internal newlines. The line is appended to a "
@@ -238,15 +305,24 @@ msgid ""
238
305
"is required, ``False`` if the line was dealt with in some way (this is the "
239
306
"same as :meth:`!runsource`)."
240
307
msgstr ""
241
-
242
- #: ../../library/code.rst:189
308
+ "推送一行原始文字到直譯器。這一行不應該有尾部換行符號;它可能有內部換行符號。這行文字"
309
+ "會被附加到緩衝區,並且直譯器的 :meth:`~InteractiveInterpreter.runsource` 方法"
310
+ "會被呼叫,並以緩衝區的串接內容做為原始碼。如果這表示命令已執行或無效,緩衝區"
311
+ "會被重設;否則,命令會不完整,且緩衝區會保持該行被附加後的樣子。如果需要更多的輸"
312
+ "入,回傳值是 ``True``,如果該行已經以某種方式處理,回傳值是 ``False``\\ (這"
313
+ "與 :meth:`!runsource` 相同)。"
314
+
315
+ #: ../../library/code.rst:183
243
316
msgid "Remove any unhandled source text from the input buffer."
244
- msgstr ""
317
+ msgstr "從輸入緩衝區移除任何未處理的原始文字。 "
245
318
246
- #: ../../library/code.rst:194
319
+ #: ../../library/code.rst:188
247
320
msgid ""
248
321
"Write a prompt and read a line. The returned line does not include the "
249
322
"trailing newline. When the user enters the EOF key sequence, :exc:"
250
323
"`EOFError` is raised. The base implementation reads from ``sys.stdin``; a "
251
324
"subclass may replace this with a different implementation."
252
325
msgstr ""
326
+ "寫入一個提示並讀取一行。回傳的行不包括尾部的換行符號。當使用者輸入 EOF 鍵序時,"
327
+ "會引發 :exc:`EOFError`。基底實作會從 ``sys.stdin`` 讀取;子類別可以用不同的實作"
328
+ "替代。"
0 commit comments