Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf3f82e0

Browse files
committed
Merge branch 'update-tutorial-controlflow' into 3.7
2 parentsdb2acbe +5964c69 commitf3f82e0

File tree

1 file changed

+67
-18
lines changed

1 file changed

+67
-18
lines changed

‎tutorial/controlflow.po

Lines changed: 67 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,18 @@ msgid ""
1010
msgstr ""
1111
"Project-Id-Version:Python 3.7\n"
1212
"Report-Msgid-Bugs-To:\n"
13-
"POT-Creation-Date:2018-06-26 18:54+0800\n"
14-
"PO-Revision-Date:2018-05-23 16:18+0000\n"
13+
"POT-Creation-Date:2018-05-23 22:27+0800\n"
14+
"PO-Revision-Date:2018-09-07 17:30+0800\n"
1515
"Last-Translator:Adrian Liaw <adrianliaw2000@gmail.com>\n"
1616
"Language-Team:Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
1717
"tw)\n"
1818
"Language:zh_TW\n"
1919
"MIME-Version:1.0\n"
2020
"Content-Type:text/plain; charset=UTF-8\n"
2121
"Content-Transfer-Encoding:8bit\n"
22+
"Language:zh_TW\n"
2223
"Plural-Forms:nplurals=1; plural=0;\n"
24+
"X-Generator:Poedit 2.1.1\n"
2325

2426
#:../../tutorial/controlflow.rst:5
2527
msgid"More Control Flow Tools"
@@ -74,8 +76,8 @@ msgid ""
7476
"intended):"
7577
msgstr""
7678
"在 Python 中的 :keyword:`for` 陳述式可能不同於在 C 或 Pascal 中所看到的使用方"
77-
"式。與其只能选代 (iterate) 一個等差級數(如 Pascal),或給與使用者定義选代步"
78-
"進方式與結束條件(如 C),Python 的 :keyword:`for`陳述选代任何序列(list 或"
79+
"式。與其只能疊代 (iterate) 一個等差級數(如 Pascal),或給與使用者定義疊代步"
80+
"進方式與結束條件(如 C),Python 的 :keyword:`for`陳述疊代任何序列(list 或"
7981
"者字串)的元素,以他們出現在序列中的順序。例如(無意雙關):\n"
8082
"\n"
8183
"::"
@@ -87,8 +89,8 @@ msgid ""
8789
"first make a copy. Iterating over a sequence does not implicitly make a "
8890
"copy. The slice notation makes this especially convenient::"
8991
msgstr""
90-
"如果你在迴圈中需要修改一個你正在选代的序列(例如重複一些選擇的元素),那麼會"
91-
"建議你先建立一個序列的拷貝。选代序列並不暗示建立新的拷貝。此時 slice 語法就讓"
92+
"如果你在迴圈中需要修改一個你正在疊代的序列(例如重複一些選擇的元素),那麼會"
93+
"建議你先建立一個序列的拷貝。疊代序列並不暗示建立新的拷貝。此時 slice 語法就讓"
9294
"這件事十分容易完成:\n"
9395
"\n"
9496
"::"
@@ -98,6 +100,8 @@ msgid ""
98100
"With ``for w in words:``, the example would attempt to create an infinite "
99101
"list, inserting ``defenestrate`` over and over again."
100102
msgstr""
103+
"在 ``for w in words:`` 的情況,這個例子會試著重覆不斷地插入 "
104+
"``defenestrate``,產生一個無限長的 list。"
101105

102106
#:../../tutorial/controlflow.rst:88
103107
msgid"The :func:`range` Function"
@@ -108,7 +112,7 @@ msgid ""
108112
"If you do need to iterate over a sequence of numbers, the built-in function :"
109113
"func:`range` comes in handy. It generates arithmetic progressions::"
110114
msgstr""
111-
"如果你需要选代一個數列的話,使用內建 :func:`range` 函式就很方便。它可以生成一"
115+
"如果你需要疊代一個數列的話,使用內建 :func:`range` 函式就很方便。它可以生成一"
112116
"等差級數:\n"
113117
"\n"
114118
"::"
@@ -122,7 +126,7 @@ msgid ""
122126
msgstr""
123127
"給定的結束值永遠不會出現在生成的序列中;\\ ``range(10)`` 生成的 10 個數值,即"
124128
"對應存取一個長度為 10 的序列內每一個元素的索引值。也可以讓 range 從其他數值計"
125-
"數,或者給定不同的級距(甚至為負;有時稱之為'step'):\n"
129+
"數,或者給定不同的級距(甚至為負;有時稱之為 step):\n"
126130
"\n"
127131
"::"
128132

@@ -131,8 +135,7 @@ msgid ""
131135
"To iterate over the indices of a sequence, you can combine :func:`range` "
132136
"and :func:`len` as follows::"
133137
msgstr""
134-
"欲选代一個序列的索引值們,你可以搭配使用 :func:`range` 和 :func:`len` 如"
135-
"下:\n"
138+
"欲疊代一個序列的索引值,你可以搭配使用 :func:`range` 和 :func:`len` 如下:\n"
136139
"\n"
137140
"::"
138141

@@ -159,7 +162,7 @@ msgid ""
159162
"really make the list, thus saving space."
160163
msgstr""
161164
"在很多情況下,由 :func:`range` 回傳的物件的行為如同一個 list,但實際上它並不"
162-
"是。它是一個物件在你选代時會回傳想要的序列的連續元素,並不會真正建出這個序列"
165+
"是。它是一個物件在你疊代時會回傳想要的序列的連續元素,並不會真正建出這個序列"
163166
"的 list,以節省空間。"
164167

165168
#:../../tutorial/controlflow.rst:142
@@ -170,10 +173,10 @@ msgid ""
170173
"keyword:`for` statement is such an *iterator*. The function :func:`list` is "
171174
"another; it creates lists from iterables::"
172175
msgstr""
173-
"我們稱這樣的物件為 *iterable*\\可选代的),意即能作為函式、陳述式中能一直"
176+
"我們稱這樣的物件為 *iterable*\\可疊代的),意即能作為函式、陳述式中能一直"
174177
"獲取連續元素直到用盡的部件。我們已經看過 :keyword:`for` 陳述式可做為如此的 "
175-
"*iterator*\\选代器)。:func:`list` 函式為另一個例子,他可以自 iterable(可"
176-
"选代物件)建立 list:\n"
178+
"*iterator*\\疊代器)。:func:`list` 函式為另一個例子,他可以自 iterable(可"
179+
"疊代物件)建立 list:\n"
177180
"\n"
178181
"::"
179182

@@ -195,6 +198,8 @@ msgid ""
195198
"The :keyword:`break` statement, like in C, breaks out of the innermost "
196199
"enclosing :keyword:`for` or :keyword:`while` loop."
197200
msgstr""
201+
":keyword:`break` 陳述,如同 C 語言,終止包含其最內部的 :keyword:`for` 或 :"
202+
"keyword:`while` 迴圈。"
198203

199204
#:../../tutorial/controlflow.rst:163
200205
msgid""
@@ -204,7 +209,7 @@ msgid ""
204209
"terminated by a :keyword:`break` statement. This is exemplified by the "
205210
"following loop, which searches for prime numbers::"
206211
msgstr""
207-
"迴圈可以帶有一個 ``else`` 段落。當迴圈歷遍选代的 list (在 :keyword:`for` "
212+
"迴圈可以帶有一個 ``else`` 段落。當迴圈歷遍疊代的 list (在 :keyword:`for` "
208213
"中)或條件為偽(在 :keyword:`while` 中)時,這個段落會被執行;但迴圈被 :"
209214
"keyword:`break` 陳述終止時則不會。底下尋找質數的迴圈即示範了這個行為:\n"
210215
"\n"
@@ -237,7 +242,7 @@ msgid ""
237242
"The :keyword:`continue` statement, also borrowed from C, continues with the "
238243
"next iteration of the loop::"
239244
msgstr""
240-
":keyword:`continue` 陳述,亦承襲於 C 語言,讓迴圈於下個选代起繼續執行:\n"
245+
":keyword:`continue` 陳述,亦承襲於 C 語言,讓所屬的迴圈繼續執行下個疊代:\n"
241246
"\n"
242247
"::"
243248

@@ -270,7 +275,7 @@ msgid ""
270275
"ignored::"
271276
msgstr""
272277
":keyword:`pass` 亦可作為一個函式或條件判斷主體的預留位置,它可幫助你以更宏觀"
273-
"的角度思考並撰寫新的程式碼。\\ :keyword:`pass`可自動忽略:\n"
278+
"的角度思考並撰寫新的程式碼。\\ :keyword:`pass`可被忽略:\n"
274279
"\n"
275280
"::"
276281

@@ -283,6 +288,9 @@ msgid ""
283288
"We can create a function that writes the Fibonacci series to an arbitrary "
284289
"boundary::"
285290
msgstr""
291+
"我們可以建立一個函式來產生費式數列到任何一個上界:\n"
292+
"\n"
293+
"::"
286294

287295
#:../../tutorial/controlflow.rst:265
288296
msgid""
@@ -291,6 +299,8 @@ msgid ""
291299
"parameters. The statements that form the body of the function start at the "
292300
"next line, and must be indented."
293301
msgstr""
302+
"關鍵字 :keyword:`def` 帶入一個函式的\\ *定義*。它之後必須連著該函式的名稱和置"
303+
"於括號之中的參數。自下一行起,所有縮排的陳述成為該函式的主體。"
294304

295305
#:../../tutorial/controlflow.rst:270
296306
msgid""
@@ -302,6 +312,11 @@ msgid ""
302312
"through code; it's good practice to include docstrings in code that you "
303313
"write, so make a habit of it."
304314
msgstr""
315+
"一個函式的第一個陳述可以是一個字串值;此情況該字串值被視為該函式的說明文件字"
316+
"串,即 :dfn:`docstring`\\ 。(關於 docstring 的細節請參見\\ :ref:`tut-"
317+
"docstrings`\\ 段落。)有些工具可以使用 docstring 來自動產生線上或可列印的文"
318+
"件,或讓使用者能自由地自原始碼中瀏覽文件。在原始碼中加入 docstring 是個好慣"
319+
"例,應該養成這樣的習慣。"
305320

306321
#:../../tutorial/controlflow.rst:277
307322
msgid""
@@ -314,6 +329,11 @@ msgid ""
314329
"assigned a value within a function (unless named in a :keyword:`global` "
315330
"statement), although they may be referenced."
316331
msgstr""
332+
"函式執行期間會建立一個新的符號表(symbol table)來儲存該函式內的區域變數。更"
333+
"精確地說,所有在函式內的變數賦值都會把該值儲存在一個區域符號表。然而,在讀取"
334+
"一個變數時,會先從區域符號表起搜尋,其次為所有包含其函式的區域符號表,其次為"
335+
"全域符號表,最後為所有內建的名稱。因此,在函式中,全域變數無法被直接賦值(除"
336+
"非該變數有被 :keyword:`global` 陳述句提及),但它們可以被讀取。"
317337

318338
#:../../tutorial/controlflow.rst:286
319339
msgid""
@@ -323,6 +343,10 @@ msgid ""
323343
"*reference*, not the value of the object). [#]_ When a function calls "
324344
"another function, a new local symbol table is created for that call."
325345
msgstr""
346+
"在一個函式被呼叫的時候,實際傳入的參數(引數)會被加入至該函數的區域符號表。"
347+
"因此,引數傳入的方式為\\ *傳值呼叫 (call by value)*\\ (這裡傳遞的「值」永遠"
348+
"是一個物件的\\ *參照(reference)*\\ ,而不是該物件的值)。\\ [#]_ 當一個函式"
349+
"呼叫別的函式時,在被呼叫的函式中會建立一個新的區域符號表。"
326350

327351
#:../../tutorial/controlflow.rst:292
328352
msgid""
@@ -332,6 +356,11 @@ msgid ""
332356
"another name which can then also be used as a function. This serves as a "
333357
"general renaming mechanism::"
334358
msgstr""
359+
"一個函式定義會把該函式名稱加入至當前的符號表。該函式名稱的值帶有一個型別,並"
360+
"被直譯器辨識為使用者自定函式(user-defined function)。該值可以被賦予給別的變"
361+
"數名,而該變數也可以被當作函式使用。這即是常見的重新命名方式:\n"
362+
"\n"
363+
"::"
335364

336365
#:../../tutorial/controlflow.rst:304
337366
msgid""
@@ -343,23 +372,35 @@ msgid ""
343372
"the only value written. You can see it if you really want to using :func:"
344373
"`print`::"
345374
msgstr""
375+
"如果你是來自別的語言,你可能不同意 ``fib`` 是個函式,而是個程序 (procedure),"
376+
"因為它並沒有回傳值。實際上,即使一個函式缺少一個 :keyword:`return` 陳述,它亦"
377+
"有一個固定的回傳值。這個值為 ``None``\\ (它是一個內建名稱)。在直譯器中單獨"
378+
"使用 ``None`` 時,通常不會被顯示。你可以使用 :func:`print` 來看到它:\n"
379+
"\n"
380+
"::"
346381

347382
#:../../tutorial/controlflow.rst:315
348383
msgid""
349384
"It is simple to write a function that returns a list of the numbers of the "
350385
"Fibonacci series, instead of printing it::"
351386
msgstr""
387+
"如果要寫一個函式回傳費式數列的 list 而不是直接印出它,這也很容易:\n"
388+
"\n"
389+
"::"
352390

353391
#:../../tutorial/controlflow.rst:331
354392
msgid"This example, as usual, demonstrates some new Python features:"
355-
msgstr""
393+
msgstr"這個例子一樣示範了一些新的 Python 特性:"
356394

357395
#:../../tutorial/controlflow.rst:333
358396
msgid""
359397
"The :keyword:`return` statement returns with a value from a function. :"
360398
"keyword:`return` without an expression argument returns ``None``. Falling "
361399
"off the end of a function also returns ``None``."
362400
msgstr""
401+
":keyword:`return` 陳述會讓一個函式回傳一個值。單獨使用 :keyword:`return` 不外"
402+
"加一個表達式作為引數會回傳 ``None``\\ 。一個函式執行到結束也會回傳 ``None``"
403+
"\\ 。"
363404

364405
#:../../tutorial/controlflow.rst:337
365406
msgid""
@@ -374,6 +415,14 @@ msgid ""
374415
"for list objects; it adds a new element at the end of the list. In this "
375416
"example it is equivalent to ``result = result + [a]``, but more efficient."
376417
msgstr""
418+
"``result.append(a)`` 陳述呼叫了一個 list 物件的 ``result`` *method(方法)*。"
419+
"method 為「屬於」一個物件的函式,命名規則為 ``obj.methodname``\\ ,其中 "
420+
"``obj`` 為某個物件(亦可為一表達式),而 ``methodname`` 為該 method 的名稱,"
421+
"並由該物件的型別所定義。不同的型別代表不同的 method。不同型別的 method 可以擁"
422+
"有一樣的名稱而不會讓 Python 混淆。(你可以使用 *class* 定義自己的物件型別和 "
423+
"method,見 :ref:`tut-classes`\\ )這裡 :meth:`append` method 定義在 list 物件"
424+
"中;它會加入一個新的元素在該 list 的末端。這個例子等同於 ``result = result + "
425+
"[a]``\\ ,但更有效率。"
377426

378427
#:../../tutorial/controlflow.rst:352
379428
msgid"More on Defining Functions"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp