@@ -7,7 +7,7 @@ msgstr ""
7
7
"Project-Id-Version :Python 3.13\n "
8
8
"Report-Msgid-Bugs-To :\n "
9
9
"POT-Creation-Date :2024-09-03 11:11+0800\n "
10
- "PO-Revision-Date :2024-10-0311:47 +0800\n "
10
+ "PO-Revision-Date :2024-10-0312:02 +0800\n "
11
11
"Last-Translator :Adrian Liaw <adrianliaw2000@gmail.com>\n "
12
12
"Language-Team :Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
13
13
"tw)\n "
@@ -47,7 +47,7 @@ msgid ""
47
47
"operation."
48
48
msgstr ""
49
49
":keyword:`import` 陳述式結合了兩個操作:首先搜尋指定的模組,然後將搜尋結果繫"
50
- "結到本地作用域中的一個名稱。:keyword:`!import`陳述式的搜索操作被定義為一個 "
50
+ "結到本地作用域中的一個名稱。:keyword:`!import`陳述式的搜尋操作被定義為一個 "
51
51
"對 :func:`__import__` 函式的呼叫,並帶有相應的引數。:func:`__import__` 的回傳"
52
52
"值用於執行 :keyword:`!import` 陳述式的名稱繫結操作。有關名稱繫結操作的詳細資"
53
53
"訊,請參見 :keyword:`!import` 陳述式。"
@@ -248,7 +248,7 @@ msgid ""
248
248
msgstr ""
249
249
"命名空間套件是由不同的\\ :term:`部分 <portion>` 組成的,每個部分都為父套件提"
250
250
"供一個子套件。這些部分可以位於檔案系統上的不同位置。部分可能也存在於壓縮檔案"
251
- "中、網路上,或 Python在引入時搜索的任何其他地方 。命名空間套件不一定直接對應"
251
+ "中、網路上,或 Python在引入時搜尋的任何其他地方 。命名空間套件不一定直接對應"
252
252
"於檔案系統中的對象;它們可能是沒有具體表示的虛擬模組。"
253
253
254
254
#: ../../reference/import.rst:141
@@ -261,7 +261,7 @@ msgid ""
261
261
msgstr ""
262
262
"命名空間套件的 ``__path__`` 屬性不使用普通的串列。它們使用自定義的可疊代型"
263
263
"別,當父套件的路徑(或頂層套件的 :data:`sys.path`)發生變化時,會在下一次引入"
264
- "嘗試時自動執行新一輪的套件部分搜索 。"
264
+ "嘗試時自動執行新一輪的套件部分搜尋 。"
265
265
266
266
#: ../../reference/import.rst:147
267
267
msgid ""
@@ -272,7 +272,7 @@ msgid ""
272
272
"create a namespace package for the top-level ``parent`` package whenever it "
273
273
"or one of its subpackages is imported."
274
274
msgstr ""
275
- "在命名空間套件中,不存在 ``parent/__init__.py`` 檔案。實際上,在引入搜索過程 "
275
+ "在命名空間套件中,不存在 ``parent/__init__.py`` 檔案。實際上,在引入搜尋過程 "
276
276
"中可能會找到多個 ``parent`` 目錄,每個目錄由不同的部分提供。因此,``parent/"
277
277
"one`` 可能與 ``parent/two`` 不會實際位於一起。在這種情況下,每當引入頂層 "
278
278
"``parent`` 套件或其子套件之一時,Python 會為頂層 ``parent`` 套件建立一個命名"
@@ -284,7 +284,7 @@ msgstr "有關命名空間套件的規範,請參見 :pep:`420`。"
284
284
285
285
#: ../../reference/import.rst:158
286
286
msgid "Searching"
287
- msgstr ""
287
+ msgstr "搜尋 "
288
288
289
289
#: ../../reference/import.rst:160
290
290
msgid ""
@@ -295,6 +295,10 @@ msgid ""
295
295
"parameters to the :func:`importlib.import_module` or :func:`__import__` "
296
296
"functions."
297
297
msgstr ""
298
+ "在開始搜尋之前,Python 需要被引入模組(或套件,但在本討論中,兩者的區別無關緊"
299
+ "要)的完整\\ :term:`限定名稱 <qualified name>`。此名稱可能來自 :keyword:"
300
+ "`import` 陳述式的各種引數,或來自 :func:`importlib.import_module` 或 :func:"
301
+ "`__import__` 函式的參數。"
298
302
299
303
#: ../../reference/import.rst:166
300
304
msgid ""
@@ -304,10 +308,14 @@ msgid ""
304
308
"baz``. If any of the intermediate imports fail, a :exc:`ModuleNotFoundError` "
305
309
"is raised."
306
310
msgstr ""
311
+ "此名稱將在引入搜尋的各個階段中使用,並且它可能是指向子模組的點分隔路徑,例如 "
312
+ "``foo.bar.baz``。在這種情況下,Python 會首先嘗試引入 ``foo``,然後是 ``foo."
313
+ "bar``,最後是 ``foo.bar.baz``。如果任何中間引入失敗,則會引發 :exc:"
314
+ "`ModuleNotFoundError`。"
307
315
308
316
#: ../../reference/import.rst:173
309
317
msgid "The module cache"
310
- msgstr ""
318
+ msgstr "模組快取 "
311
319
312
320
#: ../../reference/import.rst:178
313
321
msgid ""
@@ -318,6 +326,10 @@ msgid ""
318
326
"and ``foo.bar.baz``. Each key will have as its value the corresponding "
319
327
"module object."
320
328
msgstr ""
329
+ "在引入搜尋過程中首先檢查的地方是 :data:`sys.modules`。此對映用作所有先前引入"
330
+ "過的模組的快取,包括中間路徑。因此,如果 ``foo.bar.baz`` 之前已被引入,:data:"
331
+ "`sys.modules` 將包含 ``foo``、``foo.bar`` 和 ``foo.bar.baz`` 的條目。每個鍵的"
332
+ "值都是相應的模組物件。"
321
333
322
334
#: ../../reference/import.rst:185
323
335
msgid ""
@@ -327,6 +339,9 @@ msgid ""
327
339
"`ModuleNotFoundError` is raised. If the module name is missing, Python will "
328
340
"continue searching for the module."
329
341
msgstr ""
342
+ "在引入過程中,會在 :data:`sys.modules` 中查找模組名稱,如果存在,則相關的值為"
343
+ "滿足此引入的模組,此引入過程即完成。然而,如果值是 ``None``,則會引發 :exc:"
344
+ "`ModuleNotFoundError`。如果模組名稱不存在,Python 會繼續搜尋該模組。"
330
345
331
346
#: ../../reference/import.rst:191
332
347
msgid ""
@@ -337,6 +352,10 @@ msgid ""
337
352
"to ``None``, forcing the next import of the module to result in a :exc:"
338
353
"`ModuleNotFoundError`."
339
354
msgstr ""
355
+ ":data:`sys.modules` 是可寫入的。刪除一個鍵可能不會銷毀相關聯的模組(因為其他"
356
+ "模組可能持有對它的參照),但會使該命名模組的快取條目失效,導致 Python 在下一"
357
+ "次引入該模組時重新搜尋。也可以將鍵賦值為 ``None``,這會強制下一次引入該模組時"
358
+ "引發 :exc:`ModuleNotFoundError`。"
340
359
341
360
#: ../../reference/import.rst:198
342
361
msgid ""
@@ -346,6 +365,10 @@ msgid ""
346
365
"reload` will reuse the *same* module object, and simply reinitialise the "
347
366
"module contents by rerunning the module's code."
348
367
msgstr ""
368
+ "但請注意,如果你保留了對模組物件的參照,並在 :data:`sys.modules` 中使其快取條"
369
+ "目失效,然後重新引入該命名模組,這兩個模組物件將\\ *不會*\\ 相同。相比之下,:"
370
+ "func:`importlib.reload` 會重用\\ *相同的*\\ 模組物件,並通過重新執行模組的程"
371
+ "式碼來簡單地重新初始化模組內容。"
349
372
350
373
#: ../../reference/import.rst:208
351
374
msgid "Finders and loaders"