Skip to content

Translating tutorial/module #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 116 additions & 14 deletions tutorial/modules.po
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ msgstr ""
"Project-Id-Version: Python 3.7\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-06-28 20:03+0800\n"
"PO-Revision-Date: 2018-07-30 15:16+0800\n"
"PO-Revision-Date: 2018-08-27 14:03+0800\n"
"Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n"
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
"tw)\n"
Expand All @@ -18,7 +18,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Poedit 2.1.1\n"
"X-Generator: Poedit 2.0.9\n"

#: ../../tutorial/modules.rst:5
msgid "Modules"
Expand All @@ -37,9 +37,9 @@ msgid ""
msgstr ""
"如果從 Python 直譯器離開後又再次進入,之前(幫函式或變數)做的定義都會消失。"
"因此,想要寫一些比較長的程式時,你最好使用編輯器來準備要輸入給直譯器的內容,"
"並且用該檔案來運行它。這就是一個\\ *腳本(script)*。隨著你的程式越變越長,你"
"可能會想要把它分開成幾個檔案,讓它比較好維護。你可能也會想用一個你之前已經在"
"其他程式寫好的函式,但不想要複製該函式的原始定義到所有使用它的程式裡。"
"並且用該檔案來運行它。這就是一個\\ *腳本(script)*\\ 。隨著你的程式越變越"
"長,你可能會想要把它分開成幾個檔案,讓它比較好維護。你可能也會想用一個你之前"
"已經在其他程式寫好的函式,但不想要複製該函式的原始定義到所有使用它的程式裡。"

#: ../../tutorial/modules.rst:16
msgid ""
Expand All @@ -49,6 +49,10 @@ msgid ""
"modules or into the *main* module (the collection of variables that you have "
"access to in a script executed at the top level and in calculator mode)."
msgstr ""
"為了支援這一點,Python 有一種方法可以將定義放入檔案中,並在腳本或直譯器的互動"
"式實例中使用它們。這種檔案稱為\\ *模組(module)*\\ ;模組中的定義可以\\ *導"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我覺得 "interactive instance of the interpreter" 逐字翻會有點難懂,提議可以把「直譯器的互動式實例」改成「互動模式下的直譯器」,這樣如何?

"入(import)*\\ 到其他模組中,或是導入至 \\ *主(main)*\\ 模組(即您在最頂"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"import" 這個詞應該以不翻譯為主(見術語表),這邊的話我們可以寫成「import(導入)」,而後面所有使用到 import 一詞的地方我們可以直接寫 import。

另外,由於這邊的 import 是被動形式,所以應該要改成:模組中的定義可以「被」import 到其他模組中

"層、計算機模式下執行的腳本中,所使用的變數集合)。"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我查了一下 "calculator mode" 這個用詞,看起來 calculator mode == interactive mode [1],我覺得這樣的話翻譯裡就統一都用「互動模式」。

另外這邊語意和原文有點不太一樣,整句剖析下來應該是:

(the collection of variables that you have access to) ([in a script executed at the top level] and [in calculator mode])

所以這邊的斷句會需要修改一下。

[1] https://stackoverflow.com/questions/39240325/what-is-calculator-mode


#: ../../tutorial/modules.rst:22
msgid ""
Expand All @@ -59,28 +63,44 @@ msgid ""
"to create a file called :file:`fibo.py` in the current directory with the "
"following contents::"
msgstr ""
"模組是指包含 Python 定義和語句的檔案,檔案名稱是模組名稱的字尾加上\\ :file:‘."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

「的字尾」在這邊應該是不需要的,因為 "suffix" 是指檔案名稱的 suffix 而不是模組名稱的字尾,這邊我覺得直接把「的字尾」拿掉就和原文的意思一樣了。

另外,這邊的 rST 語法是 :file:`.py`,是 backtick 而不是 single quote。(我上次用 PoEdit 的時候它好像會自己換掉,如果你是遇到這個狀況的話請跟我說!)

"py’\\ 。在模組中,模組的名稱(作為字串)可用作全域變數\\ ``__name__``\\ 的"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/可用作/會是/

另外,這邊句子中的 name 算是一個中英混雜的狀況,因此前後應該要有實際的空格。這樣的情況下,就不需要在 ``__name__`` 的前後加上倒斜線

"值。例如,用您喜歡的文字編輯器在資料夾中創一個名為\\ :file:`fibo.py`\\ 的檔"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fibo.py 如同上一個 comment

"案,內容如下:\n"
"\n"
"::"

#: ../../tutorial/modules.rst:45
msgid ""
"Now enter the Python interpreter and import this module with the following "
"command::"
msgstr ""
"現在進入 Python 直譯器並用以下命令導入這個模組:\n"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/命令/指令/g (請將後面所有的「命令」換成「指令」)
s/導入/import/g (請將後面所有的「導入」換成 import,除非真的是字面上「導入」的意思)

"\n"
"::"

#: ../../tutorial/modules.rst:50
msgid ""
"This does not enter the names of the functions defined in ``fibo`` directly "
"in the current symbol table; it only enters the module name ``fibo`` there. "
"Using the module name you can access the functions::"
msgstr ""
"這並不會將\\ ``fibo``\\ 中定義的函數名稱直接輸入當前的符號表中;它只會輸入\\ "
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/函數/函式/g (請記得把後面所有的函數改成函式,感謝!)

另外這邊的兩個 fibo 前後都應該要有實質的空格,不需要加上倒斜線。

"``fibo``\\ 的模組名稱。使用此模組名稱,就可以訪問函數:\n"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/訪問/存取/

"\n"
"::"

#: ../../tutorial/modules.rst:61
msgid ""
"If you intend to use a function often you can assign it to a local name::"
msgstr ""
"如果您打算經常使用其中某個函數,可以將其指定至區域名稱:\n"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

雖然這邊原文是寫 local name,但意思應該比較像「區域變數」,寫成區域變數也比較符合常用的中文術語。

"\n"
"::"

#: ../../tutorial/modules.rst:71
msgid "More on Modules"
msgstr ""
msgstr "更多有關模組"

#: ../../tutorial/modules.rst:73
msgid ""
Expand All @@ -89,6 +109,9 @@ msgid ""
"only the *first* time the module name is encountered in an import statement. "
"[#]_ (They are also run if the file is executed as a script.)"
msgstr ""
"模組可以包含可執行語句以及函式的定義。這些語句是作為模組的初始化,它們只會在"
"\\ *第一次*\\ 執行模組的導入語句時執行。[#]_(如果檔案被當成腳本執行,也會執"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果說「它們只會在第一次被 import 時才會執行」,這樣好像會比較簡單

另外 [#]_ 這個是 rST 的 footnote 語法,前後也會需要加上「沒有寬度的分隔符號」

"行它們)。"

#: ../../tutorial/modules.rst:78
msgid ""
Expand All @@ -99,6 +122,10 @@ msgid ""
"know what you are doing you can touch a module's global variables with the "
"same notation used to refer to its functions, ``modname.itemname``."
msgstr ""
"每個模組都有它自己的私有符號表,模組內定義的函數會把該模組的私有符號表當成全"
"域符號表使用。因此,模組的作者可以在模組中使用全域變數,而不必擔心和使用者的"
"全域變數發生意外的名稱衝突。另一方面,如果你知道自己在做什麼,你可以用這個方"
"式取用模組的全域變數,以相同的符號引用函數,\\ ``modname. itemname``\\ 。"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

「以相同的符號引用函數」應翻譯為「以和引用函式一樣的寫法」。

另外 modname.itemname 的中間不應該有空格。


#: ../../tutorial/modules.rst:85
msgid ""
Expand All @@ -107,23 +134,35 @@ msgid ""
"for that matter). The imported module names are placed in the importing "
"module's global symbol table."
msgstr ""
"在一個模組中可以導入其他模組。把所有的\\ :keyword: `import`\\ 語句放在模組"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這邊的 :keyword:`import` 之間不應該有空格。另外這邊前後也需要實際的空格,不需要加上倒斜線。

"(就這邊來說,腳本也是一樣)的最開頭是個慣例,但並沒有強制。 被導入的模組名稱"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

句點後面有多餘的空格

"放置在原模組的全域符號表中。"

#: ../../tutorial/modules.rst:90
msgid ""
"There is a variant of the :keyword:`import` statement that imports names "
"from a module directly into the importing module's symbol table. For "
"example::"
msgstr ""
"\\ :keyword: `import`\\ 語句有另一種變形寫法,可以直接將名稱從欲導入的模組,"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keyword 和 import 之間不應該有空格,另外 import 的後面應該要有實質的空格,不需要加上倒斜線,不過前面的倒斜線可以拿掉沒關係,因為是句子的開頭,開頭不應該有空格。

"直接導入至原模組的符號表中。例如:\n"
"\n"
"::"

#: ../../tutorial/modules.rst:97
msgid ""
"This does not introduce the module name from which the imports are taken in "
"the local symbol table (so in the example, ``fibo`` is not defined)."
msgstr ""
"在 import 之後的名稱會被導入,但定義該函數的整個模組名稱並不會被引入在本地符"
"號表中(因此,示例中的\\ ``fibo``\\ 未被定義)。"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fibo 前後不應該有倒斜線


#: ../../tutorial/modules.rst:100
msgid "There is even a variant to import all names that a module defines::"
msgstr ""
"甚至還有另一種變形寫法,可以導入模組定義的所有名稱:\n"
"\n"
"::"

#: ../../tutorial/modules.rst:106
msgid ""
Expand All @@ -132,30 +171,43 @@ msgid ""
"an unknown set of names into the interpreter, possibly hiding some things "
"you have already defined."
msgstr ""
"這個寫法會導入模組中所有的名稱,除了使用底線(\\ ``_``\\ )開頭的名稱。大多數"
"情況下,Python 程式設計師不大使用這種名稱,因為它在直譯器中引入了一組未知的名"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這邊的 facility 指的是 from ... import * (這個的確是 Python 的一個非常不好的 bad practice),而不是以底線開頭命名。因此,「這種名稱」應該改成「這個功能」會比較好。

"稱,並且可能隱藏了某些您已經定義的內容。"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

比起「隱藏」,我覺得「覆蓋」會是一個更貼切的用詞。


#: ../../tutorial/modules.rst:111
msgid ""
"Note that in general the practice of importing ``*`` from a module or "
"package is frowned upon, since it often causes poorly readable code. "
"However, it is okay to use it to save typing in interactive sessions."
msgstr ""
"請注意,一般情況下並不建議從模組或套件中導入\\ ``*``\\ 的做法,因為它通常會導"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這邊的星號前後應該要有實際的空格

"致可讀性較差的程式碼。但若是使用它來保存互動式會話中的鍵入動作,則是可以接受"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/保存互動式會話中的鍵入動作/在互動模式中節省打字時間/

"的。"

#: ../../tutorial/modules.rst:115
msgid ""
"If the module name is followed by :keyword:`as`, then the name following :"
"keyword:`as` is bound directly to the imported module."
msgstr ""
"如果模組名稱後面出現\\ :keyword: `as`\\ ,則\\ :keyword: `as`\\ 之後的名稱將"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keyword 和 as 之間不應該有空格。另外除了逗號前面的那一個分隔符號,前後都應該要有實質的空格。

"直接和被導入模組綁定在一起。"

#: ../../tutorial/modules.rst:124
msgid ""
"This is effectively importing the module in the same way that ``import "
"fibo`` will do, with the only difference of it being available as ``fib``."
msgstr ""
"這個導入方式和\\ ``import fibo``\\ 同樣有效,唯一的差別是現在要用\\ ``fib``"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這邊所有的倒斜線都應該拿掉。

另外,"effectively" 通常意思是「實質上」,所以「同樣有效」也許可以改成「實質上是一樣的」。

"\\ 使用模組。"

#: ../../tutorial/modules.rst:127
msgid ""
"It can also be used when utilising :keyword:`from` with similar effects::"
msgstr ""
"在使用時也可用\\ :keyword:`from`\\ 獲得類似的效果:\n"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from 前後應該要有空格

"\n"
"::"

#: ../../tutorial/modules.rst:136
msgid ""
Expand All @@ -165,43 +217,61 @@ msgid ""
"use :func:`importlib.reload`, e.g. ``import importlib; importlib."
"reload(modulename)``."
msgstr ""
"出於效率原因,每個模組在每次和直譯器的對話(interpreter session)中僅會導入一"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"session" 這個字真的太難翻譯成中文了,直接保留原文用字吧,「每個直譯器 session」

"次。因此,如果您更改了模組,則必須重啟直譯器 — 或者,如果只是一個要交互測試的"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

中文的破折號應該占兩格。

「交互測試」聽起來有點像是某個專業術語XD 我覺得可以寫成「如果只是一個想要在互動模式下測試的模組」

"模組,可以使用\\ :func:`importlib.reload`。例如:\\ ``import importlib; "
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"importlib.reload" 之前應該要有空格。

"importlib.reload(modulename)``。"

#: ../../tutorial/modules.rst:146
msgid "Executing modules as scripts"
msgstr ""
msgstr "以腳本執行模組"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這邊我覺得可以翻成「把模組當作腳本執行」


#: ../../tutorial/modules.rst:148
msgid "When you run a Python module with ::"
msgstr ""
"當使用以下內容運行 Python 模組時:\n"
"\n"
"::"

#: ../../tutorial/modules.rst:152
msgid ""
"the code in the module will be executed, just as if you imported it, but "
"with the ``__name__`` set to ``\"__main__\"``. That means that by adding "
"this code at the end of your module::"
msgstr ""
"如同你的導入指令,模組中的代碼會被執行,但 “__name__” 設置為 “” __main__ "
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/如同你的導入指令/如同使用 import 指令/
s/代碼/程式碼/
s/設置為/被設為/

這邊應該要用兩個 backtick,如同原文。
另外也留意原文是寫 ``"__main__"``,因此裡面的括弧不能被轉換(如果遇到 PoEdit 自動轉換的狀況請告訴我)

"“”。 這意味著, 通過在模組的末尾添加以下代碼:\n"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這邊的句點後面有多的空格,另外逗點應使用全形逗點

s/通過/透過/
s/代碼/程式碼/

"\n"
"::"

#: ../../tutorial/modules.rst:160
msgid ""
"you can make the file usable as a script as well as an importable module, "
"because the code that parses the command line only runs if the module is "
"executed as the \"main\" file:"
msgstr ""
"你可以選擇將檔案作為腳本使用或做為欲導入的模組使用,因為解析(parse)命令列的"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/做為/作為/

另外這邊的意思是「同時」可以作為腳本也同時可以作為被 import 的模組,所以不應該用「或」。

"程式碼只會在當模組是 “main “ 檔案時,才會執行:"

#: ../../tutorial/modules.rst:169
msgid "If the module is imported, the code is not run::"
msgstr ""
"如果導入模組,則不會執行(”main” 區塊內的)程式碼:\n"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這邊不需要特地註明 main 區塊內,因為範例中的程式碼就只有 main 區塊

"\n"
"::"

#: ../../tutorial/modules.rst:174
msgid ""
"This is often used either to provide a convenient user interface to a "
"module, or for testing purposes (running the module as a script executes a "
"test suite)."
msgstr ""
"這通常是用來為模組提供方便的使用者介面,或者用於測試目的(運作測試套件時,以"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/運作/執行/

"腳本的方式執行模組)。"

#: ../../tutorial/modules.rst:181
msgid "The Module Search Path"
msgstr ""
msgstr "模組的搜尋路徑"

#: ../../tutorial/modules.rst:185
msgid ""
Expand All @@ -210,29 +280,38 @@ msgid ""
"file named :file:`spam.py` in a list of directories given by the variable :"
"data:`sys.path`. :data:`sys.path` is initialized from these locations:"
msgstr ""
"導入一個名為\\ :mod:`spam`\\ 的模組時,直譯器首先會搜尋具有該名稱的內建模組。"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spam 前後應有空格

"如果找不到,接下來會在變數\\ :data:`sys.path`:\\ 所給定的資料夾清單之中,搜尋"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sys.path 前後應有空格,另外 sys.path 後面有多一個冒號

"一個名為\\ :file:`spam.py`:\\ 的檔案。\\ :data:`sys.path`:\\ 從這些位置開始進"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spam.py 前後應有空格,另外其後有多餘的冒號

sys.path 的前面那個分隔符號是必須的,因為前面是句點,但其後需要有一個實質的空格。另外 sys.path 後面也有多餘的冒號。

"行初始化:"

#: ../../tutorial/modules.rst:190
msgid ""
"The directory containing the input script (or the current directory when no "
"file is specified)."
msgstr ""
msgstr "輸入腳本所位在的資料夾(如未指定檔案時,則是當前資料夾)。"

#: ../../tutorial/modules.rst:192
msgid ""
":envvar:`PYTHONPATH` (a list of directory names, with the same syntax as the "
"shell variable :envvar:`PATH`)."
msgstr ""
"\\ :envvar:`PYTHONPATH`\\ (一連串和 shell 變數\\ :envvar:`PATH`\\ 的語法相同"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:envvar:`PATH` 的前後應該要有實質的空格

"的資料夾名稱)。"

#: ../../tutorial/modules.rst:194
msgid "The installation-dependent default."
msgstr ""
msgstr "安裝相關的預設值。"

#: ../../tutorial/modules.rst:197
msgid ""
"On file systems which support symlinks, the directory containing the input "
"script is calculated after the symlink is followed. In other words the "
"directory containing the symlink is **not** added to the module search path."
msgstr ""
"在支援符號連結(symlink)的檔案系統中,輸入腳本的所在資料夾是在符號連結之後才"
"被計算的。換言之,包含符號連結的資料夾\\ **並沒有**\\ 增加到模組的搜尋路徑"
"中。"

#: ../../tutorial/modules.rst:201
msgid ""
Expand All @@ -243,10 +322,14 @@ msgid ""
"library directory. This is an error unless the replacement is intended. See "
"section :ref:`tut-standardmodules` for more information."
msgstr ""
"初始化之後,Python 程式可以修改\\ :data:`sys.path`\\ 。執行中腳本的所在資料夾"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sys.path 的前面需要空格

"會在搜尋路徑的開頭,在標準函式庫路徑之前。這代表該資料夾中的腳本會優先被載"
"入,而不是函式庫資料夾中相同名稱的模組。除非是有意要做這樣的替換,否則這是一"
"個錯誤。 請參見\\ : ref: `tut-standardmodules`\\ 以瞭解更多資訊。"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這邊的句點後面多了一個空格,另外這個 rST 語法彼此之間不能有空格,不然會產生不出對應的連結。


#: ../../tutorial/modules.rst:212
msgid "\"Compiled\" Python files"
msgstr ""
msgstr "「編譯」Python 檔案"

#: ../../tutorial/modules.rst:214
msgid ""
Expand All @@ -258,6 +341,11 @@ msgid ""
"spam.cpython-33.pyc``. This naming convention allows compiled modules from "
"different releases and different versions of Python to coexist."
msgstr ""
"為了加快載入模組的速度,Python 將每個模組的編譯版本緩存 \\ ``__pycache__``\\ "
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__pycache__ 前後應該要有空格

"資料夾下,並命名為\\ :file:`module.{version}.pyc`\\ ,此編譯版本是將編譯後的"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

module 之前要有實質的空格

"檔案格式進行編碼,且名稱通常會包含 Python 的版本邊號。 例如,在 CPython 3.3 "
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我想 "where the version encodes the format of the compiled file" 的意思是,前面那個字串(module.{version}.pyc)裡面的 "version" 是編譯後的檔案的格式名稱。會這樣講是因為不同的 CPython 版本可能會編譯出不一樣的 bytecode,而只有對應版本的 Python 直譯器(精確來說是 Python virtual machine)讀得懂那個 bytecode(也就是那個編譯完的檔案)。

另外「例如」前面有多餘的空格

"中,spam.py 的編譯版本將被緩存為 \\ ``__pycache__/spam.cpython-33.pyc``\\ 。"
"此命名準則可以讓來自不同版本的編譯模組和 Python 的不同版本同時共存。"

#: ../../tutorial/modules.rst:222
msgid ""
Expand All @@ -267,6 +355,9 @@ msgid ""
"independent, so the same library can be shared among systems with different "
"architectures."
msgstr ""
"Python 根據原始碼最後修改的日期,檢查編譯版本是否過期而需要重新編譯。這是一個"
"完全自動的過程。另外,編譯後的模組獨立於平台,因此不同體系結構的系統之間可以"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

「不同體系結構的系統」如果改成「不同架構的作業系統」也許會比較順一點?

"共用同一函式庫。"

#: ../../tutorial/modules.rst:227
msgid ""
Expand All @@ -277,10 +368,13 @@ msgid ""
"distribution, the compiled module must be in the source directory, and there "
"must not be a source module."
msgstr ""
"Python 在兩種情況下不檢查緩存。首先,它總是重新編譯,且不儲存直接從命令列載入"
"的模組的結果。 第二,如果沒有源模組,則不會檢查緩存。要支援非源模組(僅編譯)"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

句點後有多餘的空格

"的發布,編譯後的模組必須位於原始資料夾中,並且不能有源模組。"

#: ../../tutorial/modules.rst:234
msgid "Some tips for experts:"
msgstr ""
msgstr "一些給專家的秘訣:"

#: ../../tutorial/modules.rst:236
msgid ""
Expand All @@ -292,25 +386,33 @@ msgid ""
"have an ``opt-`` tag and are usually smaller. Future releases may change "
"the effects of optimization."
msgstr ""
"可以在 Python 命令上使用命令參數(switch)\\ :option:`-O`\\ 或\\ :option:`-"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

除了 switch 以及右括弧和 -O 之間應保持現在的樣子之外,-O 後面需要有空格,-OO 前後也都需要空格

"OO`\\ 來減小已編譯模組的大小。命令參數\\ ``-O``\\ 刪除 assert 語句,\\ ``OO``"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-O 後面要有空格

這邊最後面的 OO 前面少了一個減號,另外它後面要有空格

"\\ 同時刪除 assert 語句和 __doc__ 字串。由於某些程式本身可能已經很依賴於可用"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Since some programs may rely on having these available" 這句的意思應該是「由於有些程式可能依賴於上述這些內容」(即 assert 和 doc strings)

"這些選項,因此只有在您知道自己在做什麼時,才應使用此選項。 「已優化"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/選項/參數/

句點後面有多餘的空格

"(Optimized)」模組有\\ ``opt-``\\ 標記,且通常較小。未來的版本可能會改變優化"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opt- 前後應該有空格

另外,我覺得這邊這個 "Optimized" 並不是個專業術語,在原文裡使用引號也只是因為它「嚴格來說」是優化,但實質上只是把 assert 拿掉而已,並不是真的對計算效率上的改善。

"的效果。"

#: ../../tutorial/modules.rst:244
msgid ""
"A program doesn't run any faster when it is read from a ``.pyc`` file than "
"when it is read from a ``.py`` file; the only thing that's faster about ``."
"pyc`` files is the speed with which they are loaded."
msgstr ""
"讀取\\ ``. pyc``\\ 檔案時,程式的執行速度並不會比讀取\\ ``. py``\\ 檔案快。唯"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.pyc 以及 .py 前後應該要有空格

"一比較快的是地方載入的速度。"

#: ../../tutorial/modules.rst:248
msgid ""
"The module :mod:`compileall` can create .pyc files for all modules in a "
"directory."
msgstr ""
msgstr "模組\\ : mod: `compileall`\\ 可以為資料夾中的所有模組創建 .pyc 檔。"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這邊的 rST 語法需要中間沒有任何空格才能正確產生連結,另外 compileall 前後都應該有空格


#: ../../tutorial/modules.rst:251
msgid ""
"There is more detail on this process, including a flow chart of the "
"decisions, in :pep:`3147`."
msgstr ""
msgstr "更多的細節,包括決策流程圖,請參考\\ :pep: `3147`\\ 。"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這邊的 rST 語法需要中間沒有任何空格,另外 pep 3147 的前面應該要有實質空格


#: ../../tutorial/modules.rst:258
msgid "Standard Modules"
Expand Down