Translating tutorial/module by PatinaHo · Pull Request #28 · python/python-docs-zh-tw

@adrianliaw

@@ -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)*\\ ;模組中的定義可以\\ *導"

This comment has been minimized.

@adrianliaw

adrianliaw Sep 7, 2018

Collaborator

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

@@ -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)*\\ ;模組中的定義可以\\ *導"
"入(import)*\\ 到其他模組中,或是導入至 \\ *主(main)*\\ 模組(即您在最頂"

This comment has been minimized.

@adrianliaw

adrianliaw Sep 7, 2018

Collaborator

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

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

"為了支援這一點,Python 有一種方法可以將定義放入檔案中,並在腳本或直譯器的互動"
"式實例中使用它們。這種檔案稱為\\ *模組(module)*\\ ;模組中的定義可以\\ *導"
"入(import)*\\ 到其他模組中,或是導入至 \\ *主(main)*\\ 模組(即您在最頂"
"層、計算機模式下執行的腳本中,所使用的變數集合)。"

This comment has been minimized.

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

This comment has been minimized.

@adrianliaw

adrianliaw Sep 7, 2018

Collaborator

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

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

@@ -59,28 +63,44 @@ msgid ""
"to create a file called :file:`fibo.py` in the current directory with the "
"following contents::"
msgstr ""
"模組是指包含 Python 定義和語句的檔案,檔案名稱是模組名稱的字尾加上\\ :file:‘."
"py’\\ 。在模組中,模組的名稱(作為字串)可用作全域變數\\ ``__name__``\\ 的"

This comment has been minimized.

@adrianliaw

adrianliaw Sep 7, 2018

Collaborator

s/可用作/會是/

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

"可以在 Python 命令上使用命令參數(switch)\\ :option:`-O`\\\\ :option:`-"
"OO`\\ 來減小已編譯模組的大小。命令參數\\ ``-O``\\ 刪除 assert 語句,\\ ``OO``"
"\\ 同時刪除 assert 語句和 __doc__ 字串。由於某些程式本身可能已經很依賴於可用"
"這些選項,因此只有在您知道自己在做什麼時,才應使用此選項。 「已優化"

This comment has been minimized.

"OO`\\ 來減小已編譯模組的大小。命令參數\\ ``-O``\\ 刪除 assert 語句,\\ ``OO``"
"\\ 同時刪除 assert 語句和 __doc__ 字串。由於某些程式本身可能已經很依賴於可用"
"這些選項,因此只有在您知道自己在做什麼時,才應使用此選項。 「已優化"
"(Optimized)」模組有\\ ``opt-``\\ 標記,且通常較小。未來的版本可能會改變優化"

This comment has been minimized.

@adrianliaw

adrianliaw Sep 7, 2018

Collaborator

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``\\ 檔案快。唯"

This comment has been minimized.


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

This comment has been minimized.

@adrianliaw

adrianliaw Sep 7, 2018

Collaborator

這邊的 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`\\"

This comment has been minimized.

@adrianliaw

adrianliaw Sep 7, 2018

Collaborator

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