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#why-isn-t-there-a-switch-or-case-statement-…
…in-python
  • Loading branch information
SiriusKoan committed Aug 23, 2022
commit 00e6c03ee324d321ae1aa0847c2037daa4063fc8
13 changes: 12 additions & 1 deletion faq/design.po
Original file line number Diff line number Diff line change
Expand Up @@ -456,27 +456,36 @@ msgstr ""

#: ../../faq/design.rst:259
msgid "Why isn't there a switch or case statement in Python?"
msgstr ""
msgstr "為什麼 Python 內沒有 switch 或 case 陳述式?"

#: ../../faq/design.rst:261
msgid ""
"You can do this easily enough with a sequence of ``if... elif... elif... "
"else``. For literal values, or constants within a namespace, you can also "
"use a ``match ... case`` statement."
msgstr ""
"你可以用一連串的 ``if... elif... elif... else`` 來輕易達成相同的效果。對於單"
"純的值或是在命名空間內的常數,你也可以使用 ``match ... case`` 陳述式。"

#: ../../faq/design.rst:265
msgid ""
"For cases where you need to choose from a very large number of "
"possibilities, you can create a dictionary mapping case values to functions "
"to call. For example::"
msgstr ""
"如果可能性很多,你可以用字典去映射要呼叫的函式。舉例來說:\n"
"\n"
"::"

#: ../../faq/design.rst:276
msgid ""
"For calling methods on objects, you can simplify yet further by using the :"
"func:`getattr` built-in to retrieve methods with a particular name::"
msgstr ""
"對於呼叫物件裡的方法,你可以利用內建用來找尋特定方法的函式 :func:`getattr` 來"
"做進一步的簡化:\n"
"\n"
"::"

#: ../../faq/design.rst:288
msgid ""
Expand All @@ -485,6 +494,8 @@ msgid ""
"from an untrusted source, an attacker would be able to call any method on "
"your object."
msgstr ""
"我們建議在方法名稱加上前綴,以這個例子來說是 像是 ``visit_``。沒有前綴的話,"
"一旦收到從不信任來源的值,攻擊者便可以隨意呼叫在你的專案內的方法。"

#: ../../faq/design.rst:294
msgid ""
Expand Down