Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
135961e
Translate faq/design.html#why-does-python-use-indentation-for-groupin…
SiriusKoan Aug 12, 2022
87cb8f0
Translate faq/design.html#why-are-floating-point-calculations-so-inac…
SiriusKoan Aug 14, 2022
e167727
Translate faq/design.html#why-are-python-strings-immutable
SiriusKoan Aug 14, 2022
d0783eb
Translate faq/design.html#why-must-self-be-used-explicitly-in-method-…
SiriusKoan Aug 14, 2022
66257ea
Translate faq/design.html#why-can-t-i-use-an-assignment-in-an-expression
SiriusKoan Aug 15, 2022
0cc8df4
Translate faq/design.html#why-does-python-use-methods-for-some-functi…
SiriusKoan Aug 15, 2022
be90f1f
Translate faq/design.html#why-is-join-a-string-method-instead-of-a-li…
SiriusKoan Aug 15, 2022
a3418ca
Translate faq/design.html#how-fast-are-exceptions
SiriusKoan Aug 15, 2022
00e6c03
Translate faq/design.html#why-isn-t-there-a-switch-or-case-statement-…
SiriusKoan Aug 15, 2022
7fcdf2c
Translate faq/design.html#can-t-you-emulate-threads-in-the-interprete…
SiriusKoan Aug 18, 2022
4813c28
Translate faq/design.html#why-can-t-lambda-expressions-contain-statem…
SiriusKoan Aug 18, 2022
bad48ad
Translate faq/design.html#can-python-be-compiled-to-machine-code-c-or…
SiriusKoan Aug 18, 2022
8b14c96
Translate faq/design.html#how-does-python-manage-memory
SiriusKoan Aug 19, 2022
64f7119
Translate faq/design.html#why-doesn-t-cpython-use-a-more-traditional-…
SiriusKoan Aug 19, 2022
e67d201
Translate faq/design.html#why-isn-t-all-memory-freed-when-cpython-exits
SiriusKoan Aug 19, 2022
a699463
Translate faq/design.html#why-are-there-separate-tuple-and-list-data-…
SiriusKoan Aug 19, 2022
04dde0a
Translate faq/design.html#how-are-lists-implemented-in-cpython
SiriusKoan Aug 22, 2022
b09d7a4
Translate faq/design.html#how-are-dictionaries-implemented-in-cpython
SiriusKoan Aug 23, 2022
caf4b1a
Translate faq/design.html#why-must-dictionary-keys-be-immutable
SiriusKoan Aug 23, 2022
0c984c6
Translate faq/design.html#why-doesn-t-list-sort-return-the-sorted-list
SiriusKoan Aug 23, 2022
44ae53a
Translate faq/design.html#how-do-you-specify-and-enforce-an-interface…
SiriusKoan Aug 23, 2022
769b665
Translate faq/design.html#why-is-there-no-goto
SiriusKoan Aug 23, 2022
86eecf1
Translate faq/design.html#why-can-t-raw-strings-r-strings-end-with-a-…
SiriusKoan Aug 23, 2022
17d9539
Translate faq/design.html#why-doesn-t-python-have-a-with-statement-fo…
SiriusKoan Aug 23, 2022
9448b4e
Translate faq/design.html#why-don-t-generators-support-the-with-state…
SiriusKoan Aug 23, 2022
19dfed6
Translate faq/design.html#why-are-colons-required-for-the-if-while-de…
SiriusKoan Aug 23, 2022
6cb34af
Translate faq/design.html#why-does-python-allow-commas-at-the-end-of-…
SiriusKoan Aug 23, 2022
550279d
fix: missing colon
SiriusKoan Aug 23, 2022
727711e
fix: add a space between plus sign
SiriusKoan Aug 25, 2022
d3eb726
fix: typo and glossary
SiriusKoan Aug 26, 2022
117f27d
Merge branch '3.10' of https://github.com/SiriusKoan/python-docs-zh-t…
SiriusKoan Aug 26, 2022
b2ef135
fix: glossary
SiriusKoan Aug 27, 2022
a405f6b
fix: use 問答集 instead of 問題 for FAQ
SiriusKoan Aug 27, 2022
641c0e1
fix: use 疊代 instead of 迭代
SiriusKoan Aug 27, 2022
ef7cb62
Merge branch '3.10' of https://github.com/SiriusKoan/python-docs-zh-t…
SiriusKoan Aug 27, 2022
f021b24
Merge branch '3.10' into 3.10
SiriusKoan Aug 28, 2022
63b3bda
fix: reserve English name
SiriusKoan Aug 29, 2022
38787a5
fix: wrong original content (http -> https)
SiriusKoan Aug 29, 2022
435c9db
fix: wrong original content (http -> https)
SiriusKoan Aug 29, 2022
9317d96
fix: compile error due to lack of spaces
SiriusKoan Aug 29, 2022
36df673
fix conflict
SiriusKoan Aug 29, 2022
59cbd5c
fix: space besides left parentheses
SiriusKoan Aug 29, 2022
6becc4f
fix: space besides left parentheses
SiriusKoan Aug 29, 2022
44abaeb
fix: original content
SiriusKoan Aug 30, 2022
64cdaf6
Merge branch '3.10' of https://github.com/SiriusKoan/python-docs-zh-t…
SiriusKoan Aug 30, 2022
2f4b8dd
fix: extra line break
SiriusKoan Aug 31, 2022
a7f2ac6
fix: translate begin/end
SiriusKoan Aug 31, 2022
b6594e3
fix: use parentheses to replace dash
SiriusKoan Aug 31, 2022
875a69d
fix: use comma
SiriusKoan Aug 31, 2022
2206ad5
fix: 表現 -> 行為
SiriusKoan Aug 31, 2022
21d327b
fix: use " to represent string
SiriusKoan Aug 31, 2022
cb24fcf
fix: redundant original content
SiriusKoan Aug 31, 2022
9012e88
fix: redundant original content
SiriusKoan Aug 31, 2022
777894c
fix: 值組 -> 元組 and use singular noun in translation
SiriusKoan Aug 31, 2022
70aa411
fix: add original content for 字串文本
SiriusKoan Aug 31, 2022
6bd7243
fix: redundant original content
SiriusKoan Aug 31, 2022
e650bde
fix: 上下文 -> 情境
SiriusKoan Aug 31, 2022
94eefb0
fix: move the original content of 字串文本 to its first occurence
SiriusKoan Aug 31, 2022
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Translate faq/design.html#how-do-you-specify-and-enforce-an-interface…
…-spec-in-python
  • Loading branch information
SiriusKoan committed Aug 23, 2022
commit 44ae53a08433ffd991a9a04435d0403a72783e20
25 changes: 23 additions & 2 deletions faq/design.po
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ msgstr ""

#: ../../faq/design.rst:556
msgid "How do you specify and enforce an interface spec in Python?"
msgstr ""
msgstr "如何在 Python 中指定和強制使用一個介面規範 (interface spec)?"

#: ../../faq/design.rst:558
msgid ""
Expand All @@ -975,6 +975,8 @@ msgid ""
"module. Many feel that compile-time enforcement of interface specifications "
"helps in the construction of large programs."
msgstr ""
"像是 C++ 和 Java 等語言提供了模組的介面規範,他描述了該模組的方法和函式的原"
"型。很多人認為這種在編譯時強制執行的介面規範在建構大型程式時十分有幫助。"

#: ../../faq/design.rst:563
msgid ""
Expand All @@ -985,12 +987,18 @@ msgid ""
"`~collections.abc.Iterable`, :class:`~collections.abc.Container`, and :class:"
"`~collections.abc.MutableMapping`."
msgstr ""
"Python 2.6 加入了 :mod:`abc` 模組,讓你可以定義抽象基底類別 (Abstract Base "
"Classes, ABCs)。你可以使用 :func:`isinstance` 和 :func:`issubclass` 來確認一"
"個實體 (instance) 或是類別是否實作了某個抽象基底類別。而 :mod:`collections."
"abc` 模組定義了一系列好用的抽象基底類別,像是 :class:`~collections.abc."
"Iterable`、:class:`~collections.abc.Container` 和 :class:`~collections.abc."
"MutableMapping`。"

#: ../../faq/design.rst:570
msgid ""
"For Python, many of the advantages of interface specifications can be "
"obtained by an appropriate test discipline for components."
msgstr ""
msgstr "對 Python 來說,很多介面規範的優點可以用對元件適當的測試規則來達到。"

#: ../../faq/design.rst:573
msgid ""
Expand All @@ -1003,6 +1011,11 @@ msgid ""
"be used to construct exhaustive test suites that exercise every line of code "
"in a module."
msgstr ""
"一個針對模組的好測試套件提供了回歸測試 (regression testing),並作為模組介面規"
"範和一組範例。許多 Python 模組可以直接當成腳本執行,並提供簡單的「自我測"
"試」。即便模組使用了複雜的外部介面,他依然可以用外部介面的簡單的「樁」(stub) "
"模擬來獨立測試。:mod:`doctest` 和 :mod:`unittest` 模組或第三方的測試框架可以"
"用來建構詳盡徹底的測試套件來測試模組裡的每一行程式碼。"

#: ../../faq/design.rst:581
msgid ""
Expand All @@ -1014,6 +1027,11 @@ msgid ""
"test that your :meth:`append` implementation will actually do this "
"correctly, but it's trivial to check this property in a test suite."
msgstr ""
"就像介面規範一樣,一個適當的測試規則在建造大型又複雜的 Python 應用程式時可以"
"幫上忙。事實上,他可能可以有更好的表現,因為介面規範無法測試程式的特定屬性。"
"舉例來說,:meth:`append` 方法應該要在某個內部的串列最後面加上新的元素,而介面"
"規範沒辦法測試你的 :meth:`append` 是不是真的有正確的實作,但這在測試套件裡事"
"件很簡單的事。"

#: ../../faq/design.rst:589
msgid ""
Expand All @@ -1023,6 +1041,9 @@ msgid ""
"write any of the actual code. Of course Python allows you to be sloppy and "
"not write test cases at all."
msgstr ""
"撰寫測試套件相當有幫助,而你會像要把程式碼設計成好測試的樣子。測試驅動開發 "
"(test-driven development) 是一個越來越受歡迎的設計方法,他要求先完成部分的測"
"試套件,再去撰寫真的要用的程式碼。當然 Python 也允許你草率地不寫任何測試。"

#: ../../faq/design.rst:597
msgid "Why is there no goto?"
Expand Down