diff --git a/library/copy.po b/library/copy.po index daf6f08e52..00a9093a3f 100644 --- a/library/copy.po +++ b/library/copy.po @@ -1,15 +1,16 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2022, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: +# Adrian Liaw , 2018 +# Matt Wang , 2022 msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-11-15 00:09+0000\n" -"PO-Revision-Date: 2018-05-23 14:41+0000\n" -"Last-Translator: Adrian Liaw \n" +"PO-Revision-Date: 2022-01-20 18:49+0800\n" +"Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -17,10 +18,11 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Poedit 3.0.1\n" #: ../../library/copy.rst:2 msgid ":mod:`copy` --- Shallow and deep copy operations" -msgstr "" +msgstr ":mod:`copy` --- 淺層 (shallow) 和深層 (deep) 複製操作" #: ../../library/copy.rst:7 msgid "**Source code:** :source:`Lib/copy.py`" @@ -34,22 +36,26 @@ msgid "" "changing the other. This module provides generic shallow and deep copy " "operations (explained below)." msgstr "" +"Python 的賦值陳述式不複製物件,而是建立目標和物件的繫結 (binding) 關係。對於" +"可變 (mutable) 或包含可變項目 (mutable item) 的集合,有時會需要一份副本來改變" +"特定副本,而不必改變其他副本。本模組提供了通用的淺層複製和深層複製操作(如下" +"所述)。" #: ../../library/copy.rst:18 msgid "Interface summary:" -msgstr "" +msgstr "介面摘要:" #: ../../library/copy.rst:22 msgid "Return a shallow copy of *x*." -msgstr "" +msgstr "回傳 *x* 的淺層複製。" #: ../../library/copy.rst:27 msgid "Return a deep copy of *x*." -msgstr "" +msgstr "回傳 *x* 的深層複製。" #: ../../library/copy.rst:32 msgid "Raised for module specific errors." -msgstr "" +msgstr "引發針對特定模組的錯誤。" #: ../../library/copy.rst:36 msgid "" @@ -57,52 +63,60 @@ msgid "" "compound objects (objects that contain other objects, like lists or class " "instances):" msgstr "" +"淺層與深層複製的區別僅與複合物件(即包含 list 或類別的實例等其他物件的物件)" +"相關:" #: ../../library/copy.rst:39 msgid "" "A *shallow copy* constructs a new compound object and then (to the extent " "possible) inserts *references* into it to the objects found in the original." msgstr "" +"*淺層複製*\\ 建構一個新的複合物件,然後(在儘可能的範圍內)將原始物件中找到的" +"物件的\\ *參照*\\ 插入其中。" #: ../../library/copy.rst:42 msgid "" "A *deep copy* constructs a new compound object and then, recursively, " "inserts *copies* into it of the objects found in the original." msgstr "" +"*深層複製*\\ 建構一個新的複合物件,然後遞迴地將在原始物件裡找到的物件的\\ *副" +"本*\\ 插入其中。" #: ../../library/copy.rst:45 msgid "" "Two problems often exist with deep copy operations that don't exist with " "shallow copy operations:" -msgstr "" +msgstr "深層複製操作通常存在兩個問題,而淺層複製操作並不存在這些問題:" #: ../../library/copy.rst:48 msgid "" "Recursive objects (compound objects that, directly or indirectly, contain a " "reference to themselves) may cause a recursive loop." -msgstr "" +msgstr "遞迴物件(直接或間接包含對自身參照的複合物件)可能會導致遞迴迴圈。" #: ../../library/copy.rst:51 msgid "" "Because deep copy copies everything it may copy too much, such as data which " "is intended to be shared between copies." msgstr "" +"由於深層複製會複製所有內容,因此可能會有過多複製(例如應該在副本之間共享的資" +"料)。" #: ../../library/copy.rst:54 msgid "The :func:`deepcopy` function avoids these problems by:" -msgstr "" +msgstr ":func:`deepcopy` 函式用以下方式避免了這些問題:" #: ../../library/copy.rst:56 msgid "" "keeping a ``memo`` dictionary of objects already copied during the current " "copying pass; and" -msgstr "" +msgstr "保留在當前複製過程中已複製的物件的 ``memo`` 字典;以及" #: ../../library/copy.rst:59 msgid "" "letting user-defined classes override the copying operation or the set of " "components copied." -msgstr "" +msgstr "允許使用者定義的類別複寫 (override) 複製操作或複製的元件集合。" #: ../../library/copy.rst:62 msgid "" @@ -112,6 +126,10 @@ msgid "" "unchanged; this is compatible with the way these are treated by the :mod:" "`pickle` module." msgstr "" +"該模組不複製模組、方法、堆疊追蹤(stack trace)、堆疊框(stack frame)、檔" +"案、socket、視窗、陣列以及任何類似的型別。它透過不變更原始物件並將其回傳來" +"(淺層或深層地)\"複製\"函式和類別;這與 :mod:`pickle` 模組處理這類問題的方式" +"是相似的。" #: ../../library/copy.rst:67 msgid "" @@ -119,6 +137,8 @@ msgid "" "lists by assigning a slice of the entire list, for example, ``copied_list = " "original_list[:]``." msgstr "" +"字典的淺層複製可以使用 :meth:`dict.copy`\\,而 list 的淺層複製可以透過賦值整" +"個 list 的切片 (slice) 完成,例如,``copied_list = original_list[:]``\\ 。" #: ../../library/copy.rst:73 msgid "" @@ -127,6 +147,9 @@ msgid "" "information on these methods. In fact, the :mod:`copy` module uses the " "registered pickle functions from the :mod:`copyreg` module." msgstr "" +"類別可以使用與操作 pickle 相同的介面來控制複製操作,關於這些方法的描述資" +"訊請參考 :mod:`pickle` 模組。實際上,:mod:`copy` 模組使用的正是從 :mod:" +"`copyreg` 模組中註冊的 pickle 函式。" #: ../../library/copy.rst:82 msgid "" @@ -140,6 +163,12 @@ msgid "" "dictionary as second argument. The memo dictionary should be treated as an " "opaque object." msgstr "" +"想要為一個類別定義它自己的複製操作實作,可以透過定義特殊方法 :meth:" +"`__copy__` 和 :meth:`__deepcopy__`\\ 。呼叫前者以實現淺層複製操作;不必傳入額" +"外引數。呼叫後者以實現深層複製操作;它應傳入一個引數,即 ``memo`` 字典。如" +"果 :meth:`__deepcopy__` 實現需要建立一個元件的深層複製,它應當呼叫 :func:" +"`deepcopy` 函式並以該元件作為第一個引數、以該 memo 字典作為第二個引數。memo " +"字典應當被當作不透明物件 (opaque object) 來處理。" #: ../../library/copy.rst:95 msgid "Module :mod:`pickle`" @@ -150,3 +179,5 @@ msgid "" "Discussion of the special methods used to support object state retrieval and " "restoration." msgstr "" +"支援物件之狀態檢索 (state retrieval) 和恢復 (restoration) 相關特殊方法的討" +"論。"