8000 Add translation of section 9.4 · python/python-docs-zh-tw@7211270 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7211270

Browse files
committed
Add translation of section 9.4
1 parent 521be68 commit 7211270

File tree

1 file changed

+32
-4
lines changed

1 file changed

+32
-4
lines changed

tutorial/classes.po

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgstr ""
88
"Project-Id-Version: Python 3.6 TW\n"
99
"Report-Msgid-Bugs-To: \n"
1010
"POT-Creation-Date: 2018-06-26 18:54+0800\n"
11-
"PO-Revision-Date: 2018-10-19 01:44+0800\n"
11+
"PO-Revision-Date: 2018-10-19 10:05+0800\n"
1212
"Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n"
1313
"Language-Team: Chinese Traditional (http://www.transifex.com/python-tw-doc/"
1414
"python-36-tw/language/zh-Hant/)\n"
@@ -666,7 +666,7 @@ msgstr "正確的類別設計應該使用實例變數::"
666666

667667
#: ../../tutorial/classes.rst:474
668668
msgid "Random Remarks"
669-
msgstr ""
669+
msgstr "隨意的備註"
670670

671671
#: ../../tutorial/classes.rst:478
672672
msgid ""
@@ -678,6 +678,10 @@ msgid ""
678678
"just an underscore), or using verbs for methods and nouns for data "
679679
"attributes."
680680
msgstr ""
681+
"資料屬性以相同的名稱覆寫方法屬性;為了避免意外的名稱衝突,該衝突將會導致在大"
682+
"的程式中難以發現的錯,明智的方法是使用某種最小化發生衝突的機會之慣例。可能的"
683+
"慣例包含大寫方法名稱,使用小的唯一字串(可能只是下底線)替資料屬性名稱添加前"
684+
"綴,或使用動詞作為方法名稱名詞作為資料屬性名稱。"
681685

682686
#: ../../tutorial/classes.rst:485
683687
msgid ""
@@ -689,6 +693,10 @@ msgid ""
689693
"implementation details and control access to an object if necessary; this "
690694
"can be used by extensions to Python written in C.)"
691695
msgstr ""
696+
"資料屬性可能被方法及物件的普通用戶(客戶端)所參照。也就是說,類別不可用於實"
697+
"作純粹的抽象資料型態。事實上,在 Python 中沒有任何東西可以有可能使資料隱藏 "
698+
"--- 這全是基於慣例。(另一方面,以 C 實作的 Python 可以完全隱藏實作細節並且必"
699+
"要的話控制物件的存取;這樣可以被以 C 寫的 Python 擴充所使用)"
692700

693701
#: ../../tutorial/classes.rst:493
694702
msgid ""
@@ -698,6 +706,9 @@ msgid ""
698706
"without affecting the validity of the methods, as long as name conflicts are "
699707
"avoided --- again, a naming convention can save a lot of headaches here."
700708
msgstr ""
709+
"客戶端應該小心使用資料屬性 --- 客戶端可能會通過標記其資料屬性來破壞方法維持的"
710+
"不變性。注意客戶端可能增加資料屬性到實例物件,而不會影響方法的有效性,只要避"
711+
"免名稱衝突即可 --- 再一次提醒,命名慣例可以在這裡節省很多麻煩。"
701712

702713
#: ../../tutorial/classes.rst:499
703714
msgid ""
@@ -706,6 +717,8 @@ msgid ""
706717
"methods: there is no chance of confusing local variables and instance "
707718
"variables when glancing through a method."
708719
msgstr ""
720+
"在方法中參照資料屬性(或其他方法!)是沒有簡寫的。我發現這實際上增加了方法的"
721+
"可閱讀性:在看方法時,沒有機會混淆區域變數和實例變數。"
709722

710723
#: ../../tutorial/classes.rst:504
711724
msgid ""
@@ -716,14 +729,18 @@ msgid ""
716729
"that a *class browser* program might be written that relies upon such a "
717730
"convention."
718731
msgstr ""
732+
"通常,方法的第一個參數被叫做 ``self``。這僅僅只是一個慣例:``self`` 這個名字"
733+
"對 Python 來說完全沒有特別的意味。但請注意,如果不遵循慣例,你的程式碼可能對"
734+
"其他 Python 程式員來說可讀性較低,並且也可以想像一個可能依賴於此慣例編寫的 "
735+
"*class browser* 程式。"
719736

720737
#: ../../tutorial/classes.rst:510
721738
msgid ""
722739
"Any function object that is a class attribute defines a method for instances "
723740
"of that class. It is not necessary that the function definition is "
724741
"textually enclosed in the class definition: assigning a function object to a "
725742
"local variable in the class is also ok. For example::"
726-
msgstr ""
743+
msgstr "任何是類別屬性的函式物件定義了一個該類別實例的方法。"
727744

728745
#: ../../tutorial/classes.rst:527
729746
msgid ""
@@ -732,12 +749,15 @@ msgid ""
732749
"class:`C` --- ``h`` being exactly equivalent to ``g``. Note that this "
733750
"practice usually only serves to confuse the reader of a program."
734751
msgstr ""
752+
"現在 ``f``、 ``g`` 和 ``h`` 都是類別 :class:`C` 的屬性,並涉及函數物件,所以"
753+
"他們都是類別 :class:`C` 的實例的方法 --- ``h`` 與 ``g`` 是完全一樣的。請注"
754+
"意,這種做法通常只會使該程式的讀者感到困惑。"
735755

736756
#: ../../tutorial/classes.rst:532
737757
msgid ""
738758
"Methods may call other methods by using method attributes of the ``self`` "
739759
"argument::"
740-
msgstr ""
760+
msgstr "方法可以藉由使用 ``self`` 參數的方法屬性呼叫其他方法::"
741761

742762
#: ../../tutorial/classes.rst:546
743763
msgid ""
@@ -751,12 +771,20 @@ msgid ""
751771
"itself defined in this global scope, and in the next section we'll find some "
752772
"good reasons why a method would want to reference its own class."
753773
msgstr ""
774+
"方法可以用與一般函數相同的方式參照全域名稱。與方法相關的全域作用域是包含其定"
775+
"義的模組。(類別永遠不會被用作全局範圍。)雖然人們很少有一個在方法中使用全域"
776+
"資料的充分理由,但全域作用域有許多合法使用:一方面,導入全域作用域的函數和模"
777+
"組可以由方法以及在其中定義的函數和類別所使用。通常,包含該方法的類別本身被定"
778+
"義在全域作用域,\n"
779+
"在下一節,我們將找到想要參照自身類別的方法的一些好理由。"
754780

755781
#: ../../tutorial/classes.rst:556
756782
msgid ""
757783
"Each value is an object, and therefore has a *class* (also called its "
758784
"*type*). It is stored as ``object.__class__``."
759785
msgstr ""
786+
"每個值都是一個物件,因此有一個 *class*(也可以稱作 *type*)。他被存在 "
787+
"``object.__class__``。"
760788

761789
#: ../../tutorial/classes.rst:563
762790
msgid "Inheritance"

0 commit comments

Comments
 (0
0